/** * Generate a query set to use the current Model's table name & key * * @return \Parable\ORM\Query */ public function createQuery() { $query = \Parable\ORM\Query::createInstance(); $query->setTableName($this->getTableName()); $query->setTableKey($this->getTableKey()); return $query; }
/** * Generate a query set to use the current Model's table name & key * * @return \Parable\ORM\Query */ public function createQuery() { $query = \Parable\ORM\Query::createInstance(); $query->setTableName($this->getModel()->getTableName()); $query->setTableKey($this->getModel()->getTableKey()); if ($this->getOnlyCount()) { $query->select('count(*)'); } if (count($this->orderBy)) { $query->orderBy($this->orderBy['key'], $this->orderBy['direction']); } if (count($this->limit)) { $query->limit($this->limit['limit'], $this->limit['offset']); } return $query; }