We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit ca19a5cd authored by mattl's avatar mattl

Easier pkeyCols call to get primary key columns

parent 20145092
......@@ -64,6 +64,11 @@ abstract class Managed_DataObject extends Memcached_DataObject
return parent::pkeyGetClass(get_called_class(), $kv);
}
static function pkeyCols()
{
return parent::pkeyColsClass(get_called_class());
}
/**
* Get multiple items from the database by key
*
......
......@@ -34,7 +34,7 @@ class Memcached_DataObject extends Safe_DataObject
{
if (is_null($v)) {
$v = $k;
$keys = self::pkeyCols($cls);
$keys = static::pkeyCols();
if (count($keys) > 1) {
// FIXME: maybe call pkeyGetClass() ourselves?
throw new Exception('Use pkeyGetClass() for compound primary keys');
......@@ -246,7 +246,7 @@ class Memcached_DataObject extends Safe_DataObject
return $query;
}
static function pkeyCols($cls)
static function pkeyColsClass($cls)
{
$i = new $cls;
$types = $i->keyTypes();
......@@ -279,7 +279,7 @@ class Memcached_DataObject extends Safe_DataObject
$pkeyMap = array_fill_keys($keyVals, array());
$result = array_fill_keys($keyVals, array());
$pkeyCols = self::pkeyCols($cls);
$pkeyCols = static::pkeyCols();
$toFetch = array();
$allPkeys = array();
......
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