Commit ce5b4415 authored by Evan Prodromou's avatar Evan Prodromou

Get primary key for default value in Memcached_DataObject::staticGet()

parent 5e61ec5e
...@@ -34,11 +34,12 @@ class Memcached_DataObject extends Safe_DataObject ...@@ -34,11 +34,12 @@ class Memcached_DataObject extends Safe_DataObject
{ {
if (is_null($v)) { if (is_null($v)) {
$v = $k; $v = $k;
// XXX: HACK! $keys = self::pkeyCols($cls);
$i = new $cls; if (count($keys) > 1) {
$keys = $i->keys(); // FIXME: maybe call pkeyGet() ourselves?
throw new Exception('Use pkeyGet() for compound primary keys');
}
$k = $keys[0]; $k = $keys[0];
unset($i);
} }
$i = Memcached_DataObject::getcached($cls, $k, $v); $i = Memcached_DataObject::getcached($cls, $k, $v);
if ($i === false) { // false == cache miss if ($i === false) { // false == cache miss
......
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