• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/orm/query/query.php
  • Класс: Bitrix\Main\ORM\Query\Query
  • Вызов: Query::addOrder
public function addOrder($definition, $order = 'ASC')
{
	$order = strtoupper($order);

	if (!in_array($order, array('ASC', 'DESC'), true))
	{
		throw new Main\ArgumentException(sprintf('Invalid order "%s"', $order));
	}

	$connection = $this->entity->getConnection();
	$helper = $connection->getSqlHelper();

	if ($order == 'ASC')
	{
		$order = $helper->getAscendingOrder();
	}
	else
	{
		$order = $helper->getDescendingOrder();
	}

	$this->order[$definition] = $order;

	return $this;
}