Managed_DataObject gets dynamic class detection for staticGet

Compatibility: get_called_class is implemented in PHP >= 5.3.0
This commit is contained in:
Mikael Nordfeldth 2013-08-12 19:12:13 +02:00
parent 3394efca60
commit d115cddfb7

View File

@ -30,6 +30,21 @@ abstract class Managed_DataObject extends Memcached_DataObject
*/ */
public static abstract function schemaDef(); public static abstract function schemaDef();
/**
* Get an instance by key
*
* @param string $k Key to use to lookup (usually 'id' for this class)
* @param mixed $v Value to lookup
*
* @return get_called_class() object if found, or null for no hits
*
*/
static function staticGet($k,$v=NULL)
{
return parent::staticGet(get_called_class(),$k,$v);
}
/** /**
* get/set an associative array of table columns * get/set an associative array of table columns
* *