/**
  * Reloads the query adapter when it has not been initialized.
  * Should none be set, it instantiates it with the correct default values.
  * @return Query
  */
 private function reloadQueryAdapter()
 {
     if (is_null($this->activeQuery)) {
         $this->activeQuery = $this->getQueryAdapter();
         $this->activeQuery->type($this->getWordpressKey());
     }
     return $this->activeQuery;
 }
예제 #2
0
 /**
  * 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;
 }