/**
* 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);
}