]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Memcached_DataObject.php
Added type-hint for StartShowNoticeFormData hook
[quix0rs-gnu-social.git] / classes / Memcached_DataObject.php
index 41ce715210bec85bcf8f4cf314475a99a34c084c..3de7c16d9bf6d1f2c338a29604e0fd6a20c4021a 100644 (file)
@@ -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