public function modifyQuery(DpleQuery &$query) { $categoryFeature = $this->getFeature('DpleFeatureCategory'); /** Do nothing if no category was defined. */ if (!isset($categoryFeature) || !$categoryFeature->getLinkedCount()) { return; } $dbr = $query->getDbr(); /** Otherwise, also fetch the sort key for the first * category. */ $query->addVars(array('sortkey' => 'cl1.cl_sortkey_prefix')); if ($this->extras_) { $extraConds = array(); /** Add conditions based on @ref $extras_. */ foreach ($this->extras_ as $extra) { $extraConds[] = 'cl1.cl_sortkey_prefix' . $dbr->buildLike($dbr->anyString(), "|{$extra}"); } $query->addConds('(' . implode(' OR ', $extraConds) . ')'); } /** Add conditions based on @ref $notExtras_. */ foreach ((array) $this->notExtras_ as $extra) { $query->addConds('cl1.cl_sortkey_prefix NOT ' . $dbr->buildLike($dbr->anyString(), "|{$extra}")); } }