/**
  * @param PropertyExecutionResult $propertyExecutionResult
  */
 public function addPropertyExecutionResult(PropertyExecutionResult $propertyExecutionResult)
 {
     $this->propertyExecutionResult[$propertyExecutionResult->getName()] = $propertyExecutionResult;
 }
Esempio n. 2
0
 /**
  * проверяет, что все правила данного свойства удовлетворены
  *
  * @param null|mixed $propertyNewValue новое значение аттрибута (например перед сохранением в базу данных)
  * @param null|mixed $propertyOldValue старое значение аттрибута (например причтении из базы)
  *
  * @return PropertyExecutionResult
  */
 public function executeRules($propertyNewValue = null, $propertyOldValue = null)
 {
     $propertyExecutionResult = new PropertyExecutionResult($this);
     foreach ($this->getRules() as $rule) {
         $adapter = new RuleAdapter($rule);
         $executionResult = $adapter->execute($propertyNewValue, $propertyOldValue);
         $propertyExecutionResult->addRuleExecutionResult($executionResult);
     }
     return $propertyExecutionResult;
 }