diff --git a/lib/Doctrine/Access.php b/lib/Doctrine/Access.php index 65ba67b68..3be4bcfff 100644 --- a/lib/Doctrine/Access.php +++ b/lib/Doctrine/Access.php @@ -32,7 +32,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -abstract class Doctrine_Access extends Doctrine_Object implements ArrayAccess +abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements ArrayAccess { /** * setArray diff --git a/lib/Doctrine/Configurable.php b/lib/Doctrine/Configurable.php index cc309a73f..924cc60ba 100644 --- a/lib/Doctrine/Configurable.php +++ b/lib/Doctrine/Configurable.php @@ -31,7 +31,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -abstract class Doctrine_Configurable extends Doctrine_Object +abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable { /** * @var array $attributes an array of containing all attributes diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index 49ec75ca0..7913abb3f 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -32,7 +32,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -class Doctrine_Hydrate extends Doctrine_Object implements Serializable +class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializable { /** * QUERY TYPE CONSTANTS diff --git a/lib/Doctrine/Hydrate/Record.php b/lib/Doctrine/Hydrate/Record.php index 9a7dc0566..e1819b2c5 100644 --- a/lib/Doctrine/Hydrate/Record.php +++ b/lib/Doctrine/Hydrate/Record.php @@ -31,7 +31,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -class Doctrine_Hydrate_Record extends Doctrine_Object +class Doctrine_Hydrate_Record extends Doctrine_Locator_Injectable { protected $_collections = array(); @@ -119,4 +119,4 @@ class Doctrine_Hydrate_Record extends Doctrine_Object $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true); } } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Locator/Injectable.php b/lib/Doctrine/Locator/Injectable.php index fb78db082..c5e69d86a 100644 --- a/lib/Doctrine/Locator/Injectable.php +++ b/lib/Doctrine/Locator/Injectable.php @@ -43,7 +43,10 @@ class Doctrine_Locator_Injectable * @var array an array of bound resources */ protected $_resources = array(); - + /** + * @var Doctrine_Null $null Doctrine_Null object, used for extremely fast null value checking + */ + protected static $_null; /** * setLocator * this method can be used for setting the locator object locally @@ -115,4 +118,25 @@ class Doctrine_Locator_Injectable return $this; } + /** + * initNullObject + * initializes the null object + * + * @param Doctrine_Null $null + * @return void + */ + public static function initNullObject(Doctrine_Null $null) + { + self::$_null = $null; + } + /** + * getNullObject + * returns the null object associated with this object + * + * @return Doctrine_Null + */ + public static function getNullObject() + { + return self::$_null; + } } diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index 638d356bd..74f994c69 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -68,7 +68,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera { $this->_root = dirname(__FILE__); - Doctrine_Object::initNullObject(new Doctrine_Null); + Doctrine_Locator_Injectable::initNullObject(new Doctrine_Null); } /** * setDefaultAttributes @@ -591,4 +591,4 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera $r[] = ""; return implode("\n",$r); } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Validator.php b/lib/Doctrine/Validator.php index b86f9a33a..b16d45093 100644 --- a/lib/Doctrine/Validator.php +++ b/lib/Doctrine/Validator.php @@ -30,7 +30,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -class Doctrine_Validator extends Doctrine_Object +class Doctrine_Validator extends Doctrine_Locator_Injectable { /** * @var array $validators an array of validator objects @@ -317,4 +317,4 @@ class Doctrine_Validator extends Doctrine_Object return $type; } }*/ -} \ No newline at end of file +}