From: Mikael Nordfeldth Date: Thu, 4 Jun 2015 19:51:56 +0000 (+0200) Subject: Easier pkeyCols call to get primary key columns X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca19a5cd6d9a9a369e6615503aef54432ebbfbc7;p=quix0rs-gnu-social.git Easier pkeyCols call to get primary key columns --- diff --git a/classes/Managed_DataObject.php b/classes/Managed_DataObject.php index b324984b7f..925d6d3ae4 100644 --- a/classes/Managed_DataObject.php +++ b/classes/Managed_DataObject.php @@ -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 * diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 3f1945205a..91b986891c 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -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();