order by

@access public
@param  int $iLimit number of return
@param  int $iOffset offset
@return \Attila\Orm
173350
public function limit($iLimit, $iOffset = null)
	{
		$this->_iLimit = $iLimit;
		$this->_iOffset = $iOffset;
		return $this;
	}
988357
protected function getCountCommonCompileSort(array &$aData)
    {
        $oDb = Factory::service('Database');

        if (!empty($aData['sort'])) {

            /**
             * How we handle sorting
             * =====================
             *
             * - If $aData['sort'] is a string assume it's the field to sort on, use the default order
             * - If $aData['sort'] is a single dimension array then assume the first element (or the element
             *   named 'column') is the column; and the second element (or the element named 'order') is the
             *   direction to sort in
             * - If $aData['sort'] is a multidimensional array then loop each element and test as above.
             *
             **/

            if (is_string($aData['sort'])) {

                //  String
                $oDb->order_by($aData['sort']);

            } elseif (is_array($aData['sort'])) {

                $mFirst = reset($aData['sort']);

                if (is_string($mFirst)) {

                    //  Single dimension array
                    $aSort = $this->getCountCommonParseSort($aData['sort']);

                    if (!empty($aSort['column'])) {
                        $oDb->order_by($aSort['column'], $aSort['order']);
                    }

                } else {

                    //  Multi dimension array
                    foreach ($aData['sort'] as $sort) {

                        $aSort = $this->getCountCommonParseSort($sort);

                        if (!empty($aSort['column'])) {
                            $oDb->order_by($aSort['column'], $aSort['order']);
                        }
                    }
                }
            }

        }
    }
1355978
private function _writeNumFormat($format, $ifmt)
	{
		$record    = 0x041E;                      // Record identifier

		$numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
		$length    = 2 + strlen($numberFormatString);      // Number of bytes to follow


		$header    = pack("vv", $record, $length);
		$data      = pack("v", $ifmt) .  $numberFormatString;
		$this->_append($header . $data);
	}
935132
public function setPending($iRefundId, $aData = [])
    {
        $aData['status'] = self::STATUS_PENDING;
        return $this->update($iRefundId, $aData);
    }
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;
    }
1193895
public function applyOrder($order)
    {
        switch ($order) {
            case 'time':
                $this->orderBy(['created_at' => SORT_ASC]);
                break;

            case 'supports':
            default:
                $this->orderBy(['(supports / pow((((UNIX_TIMESTAMP(NOW()) - created_at) / 3600) + 2),1.8) )' => SORT_DESC]);
                break;
        }

        return $order;
    }
1207114
public function offsetSet($mOffset, $mValue)
    {
        if (!$mOffset) {
            $this->_fingeprintOrder[] = trim($mValue);
        } else {
            $this->_fingeprintOrder[$mOffset] = trim($mValue);
        }
    }
1212366
private function getFilteredRows($resultSet)
    {
        $filtered = array();

        foreach ($resultSet as $row) {
            $filtered[] = $this->getFilteredRow($row);
        }

        return $filtered;
    }
1344813
protected function orderFixturesByNumber()
    {
        $this->orderedFixtures = $this->fixtures;
        usort(
            $this->orderedFixtures,
            function ($a, $b) {
                if ($a instanceof OrderedFixtureInterface && $b instanceof OrderedFixtureInterface) {
                    if ($a->getOrder() === $b->getOrder()) {
                        return 0;
                    }

                    return $a->getOrder() < $b->getOrder() ? -1 : 1;
                } elseif ($a instanceof OrderedFixtureInterface) {
                    return $a->getOrder() === 0 ? 0 : 1;
                } elseif ($b instanceof OrderedFixtureInterface) {
                    return $b->getOrder() === 0 ? 0 : -1;
                }

                return 0;
            }
        );
    }
876554
function _FetchField($fieldOffset = -1)
	{
		$fld = new ADOFieldObject;
		$fieldOffset += 1;
		$fld->name = OCIcolumnname($this->_queryID, $fieldOffset);
		if (ADODB_ASSOC_CASE == ADODB_ASSOC_CASE_LOWER) {
			$fld->name = strtolower($fld->name);
		}
		$fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
		$fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset);
		if ($fld->type == 'NUMBER') {
			$sc = OCIColumnScale($this->_queryID, $fieldOffset);
			if ($sc == 0) {
				$fld->type = 'INT';
			}
		}
		return $fld;
	}
983622
public function moveMouse($xOffset, $yOffset)
    {
        (new WebDriverActions($this->driver))->moveByOffset(
            $xOffset, $yOffset
        )->perform();

        return $this;
    }
1159098
public function setOrderQTY($orderQty)
    {
        if (!is_array($orderQty)) {
            $this->orderQty = null;

            return false;
        }
        $isValid = true;
        $index = 0;
        while ($isValid && $index < count($orderQty)) {
            if (is_numeric($orderQty[$index]) && $orderQty[$index] > 0) {
                $isValid = true;
            } else {
                $isValid = false;
            }
            $index++;
        }
        if (!$isValid) {
            $this->orderQty = null;

            return false;
        }
        $this->orderQty = $orderQty;

        return true;
    }
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;
    }
695050
protected function _releaseFile($sIdent, $iLockMode = LOCK_EX)
    {
        $blSuccess = true;
        if (isset($this->_aLockedFileHandles[$iLockMode][$sIdent]) &&
            $this->_aLockedFileHandles[$iLockMode][$sIdent] !== false
        ) {
            // release the lock and close file
            $blSuccess = flock($this->_aLockedFileHandles[$iLockMode][$sIdent], LOCK_UN) &&
                         fclose($this->_aLockedFileHandles[$iLockMode][$sIdent]);
            unset($this->_aLockedFileHandles[$iLockMode][$sIdent]);
        }

        return $blSuccess;
    }
925773
public function orderBy($order, $append = true, $first = false)
    {
        return $this->command->orderBy($order, $append, $first);
    }
1000728
private ILigand[] order(ILigand[] ligands) {
        ILigand[] newLigands = new ILigand[ligands.length];
        System.arraycopy(ligands, 0, newLigands, 0, ligands.length);

        Arrays.sort(newLigands, numberRule);
        // this above list is from low to high precendence, so we need to revert the array
        ILigand[] reverseLigands = new ILigand[newLigands.length];
        for (int i = 0; i < newLigands.length; i++) {
            reverseLigands[(newLigands.length - 1) - i] = newLigands[i];
        }
        return reverseLigands;
    }
1294969
def filter(self, criteria: Q, offset: int = 0, limit: int = 10,
               order_by: list = ()) -> ResultSet:
        