/** * Build the find command from the criteria. Limit, Offset and Ordering are applied if applicable. * @param TSqlCriteria $criteria * @return TDbCommand. */ protected function getFindCommand($criteria) { if ($criteria === null) { return $this->getBuilder()->createFindCommand(); } $where = $criteria->getCondition(); $parameters = $criteria->getParameters()->toArray(); $ordering = $criteria->getOrdersBy(); $limit = $criteria->getLimit(); $offset = $criteria->getOffset(); $select = $criteria->getSelect(); $command = $this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select); $this->onCreateCommand($command, $criteria); return $command; }