/** * Run the query set in the query builder * * @throws \LogicException Throws exception if no query builder is set on the loader * * @return \Message\Cog\DB\Result Returns database result from query */ private function _runQuery() { if (null === $this->_queryBuilder) { throw new \LogicException('Query builder not set, run _buildQuery() first!'); } if (null !== $this->_pagination) { $this->_pagination->setCountQuery($this->_getCountQuery()); $this->_pagination->setQuery($this->_queryBuilder->getQueryString()); $result = $this->_pagination->getCurrentPageResults(); } else { $result = $this->_queryBuilder->getQuery()->run(); } $this->_queryBuilder = null; return $result; }