/** * Executes the query and resets it anew. * This is useful for returning a list of * [ID => post_title] elements. * @return hash of $key => $label values */ public function listing($key, $label) { $this->throwIfContextInvalid(); $this->reloadQueryAdapter(); $results = $this->activeQuery->listing($key, $label); $this->resetCurrentQuery(); return $results; }
/** * Takes in a resultsets and maps it to a 'post__in' * condition to port the results to the main query. * @param string $query_type * @return Query */ protected function andRelationToPostIn($query_type) { $andQuery = new Query(); // Copy the current Query but remove the OR conditions. // They will be looked up as this instance goes on with // the process. $filterCopy = $this->filters; unset($filterCopy["limit"]); unset($filterCopy["posts_per_page"]); $filterCopy[$query_type]["OR"] = array(); $filterCopy['nopaging'] = true; $andQuery->applyFilters($filterCopy); $andQuery->resetQueryRelation($query_type, 'OR'); // This forces the AND relationships to be loaded before // comparing the or parameters $andIds = $andQuery->listing("ID", "ID"); $this->where('post__in', array_values($andIds)); $this->resetQueryRelation($query_type, 'AND'); return $this; }