You are here

public function RecursiveValidator::validatePropertyValue in Plug 7

Validates a value against the constraints specified for an object's property.

Parameters

object|string $objectOrClass The object or its class name:

string $propertyName The name of the property:

mixed $value The value to validate against the: property's constraints

array|null $groups The validation groups to validate. If: none is given, "Default" is assumed

Return value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded

Overrides ValidatorInterface::validatePropertyValue

File

lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveValidator.php, line 133

Class

RecursiveValidator
Recursive implementation of {@link ValidatorInterface}.

Namespace

Symfony\Component\Validator\Validator

Code

public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) {

  // If a class name is passed, take $value as root
  return $this
    ->startContext(is_object($objectOrClass) ? $objectOrClass : $value)
    ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups)
    ->getViolations();
}