/** * {@inheritdoc} */ public function prepareRules(IFilter $objFilter, $arrFilterUrl) { $objFilterRule = new FilterRuleOr($this->get('stop_after_match')); foreach ($this->arrChildren as $objChildSetting) { $objSubFilter = new Filter($this->getMetaModel()); $objChildSetting->prepareRules($objSubFilter, $arrFilterUrl); $objFilterRule->addChild($objSubFilter); } $objFilter->addFilterRule($objFilterRule); }
/** * {@inheritdoc} */ public function prepareRules(IFilter $objFilter, $arrFilterUrl) { $objMetaModel = $this->getMetaModel(); $objAttribute = $objMetaModel->getAttributeById($this->get('attr_id')); $strParam = $this->getParamName(); if ($objAttribute && $strParam) { $arrFilterValue = $arrFilterUrl[$strParam]; if ($arrFilterValue && is_array($arrFilterValue)) { if (count($arrFilterValue) > 1) { $objParentRule = new ConditionOr(); foreach ($arrFilterValue as $strValue) { $objSubFilter = new Filter($objMetaModel); $objSubFilter->addFilterRule(new SearchAttribute($objAttribute, $strValue)); $objParentRule->addChild($objSubFilter); } $objFilter->addFilterRule($objParentRule); return; } else { $objFilter->addFilterRule(new SearchAttribute($objAttribute, $arrFilterValue)); return; } } } }
/** * Method to optimize as many system column lookup filters as possible into a combined filter rule. * * @param ConditionAnd|ConditionOr $filterRule The filter to which the optimized rule shall be added to. * * @param array $children The children to parse. * * @param string $operation The operation to parse (AND or OR). * * @return array */ protected function optimizedFilter($filterRule, $children, $operation) { $procedure = new FilterBuilderSql($this->getMetaModel()->getTableName(), $operation, $this->getDatabase()); $skipped = $this->buildNativeSqlProcedure($procedure, $children); if (!$procedure->isEmpty()) { $filterRule->addChild($this->getMetaModel()->getEmptyFilter()->addFilterRule($procedure->build())); } return $skipped; }