Commit e32f2b0a authored by mmn's avatar mmn

Not really necessary in practice but makes better queries

parent 8c6d0759
......@@ -67,10 +67,11 @@ class Memcached_DataObject extends Safe_DataObject
* @param string $cls Class to fetch
* @param string $keyCol name of column for key
* @param array $keyVals key values to fetch
* @param boolean $skipNulls skip provided null values
*
* @return array Array of objects, in order
*/
static function multiGetClass($cls, $keyCol, array $keyVals)
static function multiGetClass($cls, $keyCol, array $keyVals, $skipNulls=true)
{
$obj = new $cls;
......@@ -83,6 +84,14 @@ class Memcached_DataObject extends Safe_DataObject
throw new ServerException('Cannot do multiGet on anything but integer columns');
}
if ($skipNulls) {
foreach ($keyVals as $key=>$val) {
if (is_null($val)) {
unset($keyVals[$key]);
}
}
}
$obj->whereAddIn($keyCol, $keyVals, $colType);
// Since we're inputting straight to a query: format and escape
......
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