Commit 2d24e9ad authored by lsmith's avatar lsmith

- lazy load the _tableFactory and record listener in order to reduce the...

- lazy load the _tableFactory and record listener in order to reduce the dependencies for a to be created DBAL package
parent 3a5bd47f
...@@ -298,7 +298,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable ...@@ -298,7 +298,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
if (isset($this->parent)) { if (isset($this->parent)) {
return $this->parent->getRecordListener(); return $this->parent->getRecordListener();
} }
return null; $this->attributes[Doctrine::ATTR_RECORD_LISTENER] = new Doctrine_Record_Listener();
} }
return $this->attributes[Doctrine::ATTR_RECORD_LISTENER]; return $this->attributes[Doctrine::ATTR_RECORD_LISTENER];
} }
......
...@@ -219,8 +219,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun ...@@ -219,8 +219,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$this->setParent($manager); $this->setParent($manager);
$this->_tableFactory = new Doctrine_Table_Factory($this);
$this->setAttribute(Doctrine::ATTR_CASE, Doctrine::CASE_NATURAL); $this->setAttribute(Doctrine::ATTR_CASE, Doctrine::CASE_NATURAL);
$this->setAttribute(Doctrine::ATTR_ERRMODE, Doctrine::ERRMODE_EXCEPTION); $this->setAttribute(Doctrine::ATTR_ERRMODE, Doctrine::ERRMODE_EXCEPTION);
...@@ -1049,6 +1047,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun ...@@ -1049,6 +1047,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
if (isset($this->tables[$className])) { if (isset($this->tables[$className])) {
return $this->tables[$className]; return $this->tables[$className];
} }
if (!($this->_tableFactory instanceOf Doctrine_Table_Factory)) {
$this->_tableFactory = new Doctrine_Table_Factory($this);
}
$this->_tableFactory->loadTables($className, $this->tables); $this->_tableFactory->loadTables($className, $this->tables);
return $this->tables[$className]; return $this->tables[$className];
} }
......
...@@ -95,7 +95,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera ...@@ -95,7 +95,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
Doctrine::ATTR_QUERY_CACHE => null, Doctrine::ATTR_QUERY_CACHE => null,
Doctrine::ATTR_LOAD_REFERENCES => true, Doctrine::ATTR_LOAD_REFERENCES => true,
Doctrine::ATTR_LISTENER => new Doctrine_EventListener(), Doctrine::ATTR_LISTENER => new Doctrine_EventListener(),
Doctrine::ATTR_RECORD_LISTENER => new Doctrine_Record_Listener(), Doctrine::ATTR_RECORD_LISTENER => null,
Doctrine::ATTR_THROW_EXCEPTIONS => true, Doctrine::ATTR_THROW_EXCEPTIONS => true,
Doctrine::ATTR_VALIDATE => Doctrine::VALIDATE_NONE, Doctrine::ATTR_VALIDATE => Doctrine::VALIDATE_NONE,
Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS, Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment