Ejemplo n.º 1
0
 /**
  * Merges the output of the child queries by using a common key
  *
  * @param {string} $key
  */
 private function mergeByKey($key, $orderBy)
 {
     $result = array();
     foreach ($this->children as $query) {
         $rows = $query->select($this->paramValues, $query->keyField($key), false);
         Arrays::mergeAssocs($result, $rows, $orderBy, $this->orderType);
     }
     // Convert 'back' to indexed array in case the main query has no output key
     if (!$this->output->key) {
         return Arrays::toIndexed($result);
     }
     return $result;
 }