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
1 changed files with 16 additions and 1 deletions

View File

@ -30,6 +30,21 @@ abstract class Managed_DataObject extends Memcached_DataObject
*/
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
*
@ -202,4 +217,4 @@ abstract class Managed_DataObject extends Memcached_DataObject
}
return $ckeys;
}
}
}