Symfony\Component\Validator\ConstraintViolation::getRoot PHP Method

getRoot() public method

public getRoot ( )
    public function getRoot()
    {
        return $this->root;
    }

Usage Example

 /**
  * Process violation
  *
  * @param ConstraintViolation $violation
  *
  * @return void
  */
 private function processViolation(ConstraintViolation $violation)
 {
     $id = $violation->getRoot() instanceof CrudEntityInterface ? $violation->getRoot()->getPrimaryKey() : null;
     $errors = $this->getEntityErrors($id);
     $context = $this->determineContext($violation);
     $error = new Error($violation->getMessage(), $violation->getCode(), $violation->getPropertyPath(), $context);
     $errors->add($error);
     $this->errors->set($id, $errors);
 }
All Usage Examples Of Symfony\Component\Validator\ConstraintViolation::getRoot