Sortuje dzieci wybranego rodzica
@param integer $order wstawiona kolejność
171226
protected function _sortChildren()
    {
        $i = 0;
        //pobranie dzieci swojego rodzica
        foreach ($this->_getChildren($this->parentId, true) as $categoryRecord) {
            //ten rekord musi pozostać w niezmienionej pozycji (był sortowany)
            if ($categoryRecord->id == $this->id) {
                continue;
            }
            //ten sam order wskakuje za rekord
            if ($this->order == $i) {
                $i++;
            }
            //obliczanie nowej kolejności
            $categoryRecord->order = $i++;
            //blokada dalszego sortowania i zapis
            $categoryRecord
                ->setOption('block-ordering', true)
                ->save();
        }
    }
486208
public function removeOrderFromAvailableOrders($order)
    {
        $this->loadAvailableOrders();

        if (isset($this->availableOrder[$order])) {
            unset($this->availableOrder[$order]);
        }

        return $this;
    }
541732
public function thenBy($order)
    {
        $order = LambdaUtils::toSelectCallable($order);
        $this->orders[] = array("property" => $order, "direction" => self::ORDER_ASC);
        return $this;
    }
29755
protected function checkOrder($order='') {
         if(is_string($order) && !empty($order)) {
            $orders = explode(',',$order);
            $_order = array();
            foreach ($orders as $order){
                $array  =   explode(' ',trim($order));
                $field  =   $array[0];
                $sort   =   isset($array[1])?$array[1]:'ASC';
                if(array_key_exists($field,$this->mapFields)){
                    // 需要处理映射字段
                    $field  =   $this->mapFields[$field];
                }                
                $_order[] = $field.' '.$sort;
            }
            $order = implode(',',$_order);
         }
        return $order;
    }
256465
public function getOrderMethod()
    {
        //iteracja po sortowaniach w gridzie
        foreach ($this->_grid->getState()->getOrder() as $order) {
            //znalezione sortowanie tego pola
            //gdy jest podana nazwa tabeli
            if ($order->getTableName()) {
                if ($order->getTableName() . '.' . $order->getField() == $this->getName()) {
                    //zwrot metody sortowania
                    return $order->getMethod();
                }
            } else { //bez tabeli
                if ($order->getField() == $this->getName()) {
                    //zwrot metody sortowania
                    return $order->getMethod();
                }
            }
        }
    }
675656
private function getOrderAndSeed($order)
    {
        @list($order, $seed) = explode(':', $order, 2);

        if (empty($seed)) {
            $seed = $this->getRandomSeed();
        }

        if (!is_numeric($seed)) {
            $this->showError("Could not use '$seed' as seed.");
        }

        return array($order, $seed);
    }
201826
public function orderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false);
    }
1282819
public function sortPrimaryKeys(array $order = null)
    {
        if (!$order) {
            ksort($this->values);

            return;
        }

        $orderedKeys = array_intersect_key(array_flip($order), $this->values);

        $this->values = array_replace($orderedKeys, $this->values);
    }
90252
public function setOrder($order)
    {
        if (!in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
            throw new LogicException('Invalid order argument.');
        }

        $this->order = $order;

        return $this;
    }
319677
public function orderByMultiple($order = array('_leftnode' => 'asc'), $alias = null)
    {
        if (true === empty($order)) {
            $order = array('_leftnode' => 'asc');
        }

        $this->resetDQLPart('orderBy');
        $alias = $this->getFirstAlias($alias);
        foreach ($order as $field => $sort) {
            if (0 < count($this->getDQLPart('orderBy'))) {
                $this->addOrderBy($alias.'.'.$field, $sort);
            } else {
                $this->orderBy($alias.'.'.$field, $sort);
            }
        }

        return $this;
    }
706349
public function order($order = null) {
		if ($order) {
			$this->_config['order'] = $order;
			return $this;
		}
		return $this->_config['order'];
	}
1214027
public function byFieldValue(
        string $field,
        string $order
    ): SortBy {
        $this->sortsBy[] = [
            'type' => self::TYPE_FIELD,
            'field' => Item::getPathByField($field),
            'order' => $order,
        ];

        return $this;
    }
793328
protected function prepareOrder(array &$order)
    {
        $this->setItemTotalFormatted($order, $this->price);
        $this->setItemTotalFormattedNumber($order, $this->price);
    }
996939
public function orderByMultiple($order = ['_position' => 'ASC', '_leftnode' => 'ASC'])
    {
        if (true === empty($order)) {
            $order = ['_position' => 'ASC', '_leftnode' => 'ASC'];
        }

        $this->resetDQLPart('orderBy');
        foreach ($order as $field => $sort) {
            $this->addOrderBy($field, $sort);
        }

        return $this;
    }
1231726
public function setOrder(\Core\Entity\Order $order = null) {
        $this->order = $order;

        return $this;
    }
846537
public function destroy(Order $order)
    {
        $this->order->destroy($order);

        return redirect()->route('admin.order.order.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('order::orders.title.orders')]));
    }
769728
private function sortByArray($items, array $order)
    {
        $unordered = [];
        foreach ($items as $content) {
            $unordered[$content->getId()] = $content;
        }

        $ordered = [];
        foreach ($order as $id) {
            if (isset($unordered[$id])) {
                $ordered[] = $unordered[$id];
            }
        }

        return $ordered;
    }