CRM_Util_SQL_Select::merge() - Accept an array of multiple fragments
authorTim Otten <totten@civicrm.org>
Fri, 2 Mar 2018 01:46:45 +0000 (17:46 -0800)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Tue, 19 Jun 2018 07:44:00 +0000 (13:14 +0530)
CRM/Utils/SQL/Select.php

index 23adc513d4be277a6e9afffab92c92ce8ec5945b..eb40b59074dc8ce15b535accd0f488854bd9ed03 100644 (file)
@@ -177,7 +177,7 @@ class CRM_Utils_SQL_Select implements ArrayAccess {
   /**
    * Merge something or other.
    *
-   * @param CRM_Utils_SQL_Select $other
+   * @param array|CRM_Utils_SQL_Select $other
    * @param array|NULL $parts
    *   ex: 'joins', 'wheres'
    * @return CRM_Utils_SQL_Select
@@ -187,6 +187,13 @@ class CRM_Utils_SQL_Select implements ArrayAccess {
       return $this;
     }
 
+    if (is_array($other)) {
+      foreach ($other as $fragment) {
+        $this->merge($fragment, $parts);
+      }
+      return $this;
+    }
+
     if ($this->mode === self::INTERPOLATE_AUTO) {
       $this->mode = $other->mode;
     }