private function addOrders(ModelCriteria &$query)
    {
        Logger::log(static::class . ' extract orders start ', LOG_DEBUG);
        $orderAdded = FALSE;
        $tableMap = $this->getTableMap();
        foreach ($this->order->getOrders() as $field => $direction) {
            if ($column = ApiHelper::checkFieldExists($tableMap, $field)) {
                $orderAdded = TRUE;
                if ($direction === Order::ASC) {
                    $query->addAscendingOrderByColumn($column->getPhpName());
                } else {
                    $query->addDescendingOrderByColumn($column->getPhpName());
                }
            }
        }
        if (!$orderAdded) {
            $pks = $this->getPkDbName();
            foreach(array_keys($pks) as $key) {
                $query->addAscendingOrderByColumn($key);
            }
        }
        Logger::log(static::class . ' extract orders end', LOG_DEBUG);
    }
private function addOrders(ModelCriteria &$query)
    {
        Logger::log(static::class . ' extract orders start ', LOG_DEBUG);
        $orderAdded = FALSE;
        $tableMap = $this->getTableMap();
        foreach ($this->order->getOrders() as $field => $direction) {
            if ($column = ApiHelper::checkFieldExists($tableMap, $field)) {
                $orderAdded = TRUE;
                if ($direction === Order::ASC) {
                    $query->addAscendingOrderByColumn($column->getPhpName());
                } else {
                    $query->addDescendingOrderByColumn($column->getPhpName());
                }
            }
        }
        if (!$orderAdded) {
            $pks = $this->getPkDbName();
            foreach(array_keys($pks) as $key) {
                $query->addAscendingOrderByColumn($key);
            }
        }
        Logger::log(static::class . ' extract orders end', LOG_DEBUG);
    }
private function addOrders ( ModelCriteria & $ query ) { Logger :: log ( static :: class . ' extract orders start ' , LOG_DEBUG ) ; $ orderAdded = FALSE ; $ tableMap = $ this -> getTableMap ( ) ; foreach ( $ this -> order -> getOrders ( ) as $ field => $ direction ) { if ( $ column = ApiHelper :: checkFieldExists ( $ tableMap , $ field ) ) { $ orderAdded = TRUE ; if ( $ direction === Order :: ASC ) { $ query -> addAscendingOrderByColumn ( $ column -> getPhpName ( ) ) ; } else { $ query -> addDescendingOrderByColumn ( $ column -> getPhpName ( ) ) ; } } } if ( ! $ orderAdded ) { $ pks = $ this -> getPkDbName ( ) ; foreach ( array_keys ( $ pks ) as $ key ) { $ query -> addAscendingOrderByColumn ( $ key ) ; } } Logger :: log ( static :: class . ' extract orders end' , LOG_DEBUG ) ; }
Add order fields to query
@param ModelCriteria $query
@throws \PSFS\base\exception\ApiException
Add order fields to query