From 4b11dbe3cf7ff1fec6aeb53599e11ae92930a421 Mon Sep 17 00:00:00 2001 From: Tristan Lins Date: Thu, 29 Aug 2013 16:32:49 +0200 Subject: [PATCH] Add a registry to each database connection. --- .../modules/core/library/Contao/Database.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/system/modules/core/library/Contao/Database.php b/system/modules/core/library/Contao/Database.php index 72c468be29..6105586434 100644 --- a/system/modules/core/library/Contao/Database.php +++ b/system/modules/core/library/Contao/Database.php @@ -63,6 +63,12 @@ abstract class Database */ protected $arrCache = array(); + /** + * Model registry + * @var \Model\Registry + */ + protected $objModelRegistry; + /** * Establish the database connection @@ -75,6 +81,7 @@ protected function __construct(array $arrConfig) { $this->arrConfig = $arrConfig; $this->connect(); + $this->objModelRegistry = new \Model\Registry($this); if (!is_resource($this->resConnection) && !is_object($this->resConnection)) { @@ -164,6 +171,17 @@ public static function getInstance(array $arrCustom=null) } + /** + * Return the model registry bound to this connection. + * + * @return \Model\Registry The model registry. + */ + public function getModelRegistry() + { + return $this->objModelRegistry; + } + + /** * Prepare a query and return a Database\Statement object *