Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Add a registry to each database connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlins committed Sep 29, 2013
1 parent 2efc0e4 commit 4b11dbe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions system/modules/core/library/Contao/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ abstract class Database
*/
protected $arrCache = array();

/**
* Model registry
* @var \Model\Registry
*/
protected $objModelRegistry;


/**
* Establish the database connection
Expand All @@ -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))
{
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 4b11dbe

Please sign in to comment.