public setOrderings ( array $orderings ) : Neos\Flow\Persistence\QueryInterface | ||
$orderings | array | The property names to order by |
return | Neos\Flow\Persistence\QueryInterface |
public function setOrderings(array $orderings)
{
$this->orderings = $orderings;
$this->queryBuilder->resetDQLPart('orderBy');
foreach ($this->orderings as $propertyName => $order) {
$this->queryBuilder->addOrderBy($this->getPropertyNameWithAlias($propertyName), $order);
}
return $this;
}
/** * Returns a query for objects of this repository * * @return Query * @api */ public function createQuery() { $query = new Query($this->objectType); if ($this->defaultOrderings) { $query->setOrderings($this->defaultOrderings); } return $query; }