Nextras\Orm\Collection\ICollection::orderBy PHP Method

orderBy() public method

Returns new instance of collection.
public orderBy ( string | array $column, string $direction = self::ASC ) : Nextras\Orm\Collection\ICollection
$column string | array column name or array of column names
$direction string sorting direction self::ASC or self::DESC
return Nextras\Orm\Collection\ICollection
    public function orderBy($column, $direction = self::ASC);

Usage Example

 protected function applyDefaultOrder(ICollection $collection)
 {
     if ($this->metadata->relationship->order !== NULL) {
         return $collection->orderBy($this->metadata->relationship->order[0], $this->metadata->relationship->order[1]);
     } else {
         return $collection;
     }
 }