/** * @param Query $query */ public function __construct(Query $query) { $this->query = $query; $this->models = []; $this->start = $query->getStart(); $this->limit = $query->getLimit(); $this->pointer = $this->start; $sort = $query->getSort(); if (empty($sort)) { $model = $query->getModel(); $idProperties = $model::getIDProperties(); foreach ($idProperties as &$property) { $property .= ' asc'; } $query->sort(implode(',', $idProperties)); } }