DMS\Filter\Filters\Loader\FilterLoaderInterface::getFilterForRule PHP Method

getFilterForRule() public method

Finds the filter responsible for executing a specific rule
public getFilterForRule ( Rule $rule ) : BaseFilter
$rule DMS\Filter\Rules\Rule
return DMS\Filter\Filters\BaseFilter
    public function getFilterForRule(Rule $rule);

Usage Example

Example #1
0
 /**
  * Applies a Filtering Rule to a property
  *
  * @param string $property
  * @param Rules\Rule $filterRule
  *
  * @throws \UnexpectedValueException
  */
 public function applyFilterRule($property, Rules\Rule $filterRule)
 {
     if ($this->filterLoader === null) {
         throw new \UnexpectedValueException("A FilterLoader must be provided");
     }
     $value = $this->getPropertyValue($property);
     $filter = $this->filterLoader->getFilterForRule($filterRule);
     if ($filter instanceof ObjectAwareFilter) {
         $filter->setCurrentObject($this->object);
     }
     $filteredValue = $filter->apply($filterRule, $value);
     $this->setPropertyValue($property, $filteredValue);
 }
All Usage Examples Of DMS\Filter\Filters\Loader\FilterLoaderInterface::getFilterForRule
FilterLoaderInterface