/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { $query = $this->db->getQuery(true); $queryHelper = $this->getQueryHelper(); // Prepare $this->prepareGetQuery($query); // Build filter query $this->processFilters($query, ArrayHelper::flatten((array) $this->get('filter'))); // Build search query $this->processSearches($query, ArrayHelper::flatten((array) $this->get('search'))); // Ordering $this->processOrdering($query); // Custom Where foreach ((array) $this->state->get('query.where', array()) as $k => $v) { $query->where($v); } // Custom Having foreach ((array) $this->state->get('query.having', array()) as $k => $v) { $query->having($v); } // Build query // ======================================================================== // Get select columns $select = $this->state->get('query.select'); if (!$select) { $select = $queryHelper->getSelectFields(); } $query->select($select); // Build Selected tables query $queryHelper->registerQueryTables($query); $this->postGetQuery($query); // Debug if (JDEBUG) { ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query))); } return $query; }
/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { $query = $this->db->getQuery(true); $queryHelper = $this->container->get('model.' . $this->getName() . '.helper.query'); // Prepare $this->prepareGetQuery($query); // Build filter query $this->processFilters($query, $this->state->get('filter', array())); // Build search query $this->processSearches($query, $this->state->get('search', array())); // Ordering $this->processOrdering($query); // Custom Where foreach ((array) $this->state->get('query.where', array()) as $k => $v) { $query->where($v); } // Custom Having foreach ((array) $this->state->get('query.having', array()) as $k => $v) { $query->having($v); } // Build query // ======================================================================== // Get select columns $select = $this->state->get('query.select'); if (!$select) { $selectType = $this->selectType ?: QueryHelper::COLS_WITH_FIRST | QueryHelper::COLS_PREFIX_WITH_FIRST; $select = $queryHelper->getSelectFields($selectType); } $query->select($select); // Build Selected tables query $queryHelper->registerQueryTables($query); $this->postGetQuery($query); // Debug if (JDEBUG) { ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query))); } return $query; }