From: Tim Otten Date: Fri, 2 Mar 2018 01:46:45 +0000 (-0800) Subject: CRM_Util_SQL_Select::merge() - Accept an array of multiple fragments X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ec2eca5ae29a2bd055c22d9af013b7aa8baf613e;p=civicrm-core.git CRM_Util_SQL_Select::merge() - Accept an array of multiple fragments --- diff --git a/CRM/Utils/SQL/Select.php b/CRM/Utils/SQL/Select.php index 23adc513d4..eb40b59074 100644 --- a/CRM/Utils/SQL/Select.php +++ b/CRM/Utils/SQL/Select.php @@ -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; }