/** * @param $result * * @return array */ private function fetchJoin($result) { $joins = $this->_queryBuilder->getJoins(); if (count($joins) > 0) { $fetched = array(); $i = 0; // loop trough results foreach ($result as $res) { // add result to array $fetched[$i] = $res; foreach ($joins as $join) { $fetched[$i][$join->getIdentifier()] = array(); // loop trough join data foreach ($join->getData() as $joinData) { // if there are join values then add to array if ($this->getJoinValues($res, $join, $joinData)) { $fetched[$i][$join->getIdentifier()][] = $this->getJoinValues($res, $join, $joinData); } } } ++$i; } $result = $fetched; } return $result; }