/** * @param Select $select * @param array $parts * * @return $this */ protected function writeSelectOrderBy(Select $select, array &$parts) { $str = ""; if (count($select->getAllOrderBy())) { $orderByArray = $select->getAllOrderBy(); array_walk($orderByArray, function (&$orderBy) { $orderBy = $this->writeOrderBy($orderBy); }); $str = "ORDER BY "; $str .= implode(", ", $orderByArray); } $parts = array_merge($parts, [$str]); return $this; }
/** * @param Select $select * @param array $parts * * @return $this */ protected function writeSelectOrderBy(Select $select, array &$parts) { $str = ''; if (\count($select->getAllOrderBy())) { $orderByArray = $select->getAllOrderBy(); \array_walk($orderByArray, function (&$orderBy) { $orderBy = $this->writeOrderBy($orderBy); }); $str = 'ORDER BY '; $str .= \implode(', ', $orderByArray); } $parts = \array_merge($parts, [$str]); return $this; }
/** * @param Select $select * @param array $parts * * @return $this */ public function writeSelectOrderBy(Select $select, array &$parts) { $str = ""; if (count($select->getAllOrderBy())) { $orderByArray = $select->getAllOrderBy(); $me = $this; array_walk($orderByArray, function (&$orderBy) use($me) { $orderBy = $me->writeOrderBy($orderBy); }); $str = "ORDER BY "; $str .= implode(", ", $orderByArray); } $parts = array_merge($parts, array($str)); return $this; }