protected function walkMember(MemberMetadata $metadata, $value, $group, $propertyPath) { $this->context->setCurrentProperty($metadata->getPropertyName()); foreach ($metadata->findConstraints($group) as $constraint) { $this->walkConstraint($constraint, $value, $group, $propertyPath); } }
/** * Constructor. * * @param string $class The class this property is defined on * @param string $name The name of this property */ public function __construct($class, $name) { if (!property_exists($class, $name)) { throw new ValidatorException(sprintf('Property %s does not exists in class %s', $name, $class)); } parent::__construct($class, $name, $name); }
/** * Constructor. * * @param string $class The class the getter is defined on * @param string $property The property which the getter returns */ public function __construct($class, $property) { $getMethod = 'get' . ucfirst($property); $isMethod = 'is' . ucfirst($property); if (method_exists($class, $getMethod)) { $method = $getMethod; } else { if (method_exists($class, $isMethod)) { $method = $isMethod; } else { throw new ValidatorException(sprintf('Neither method %s nor %s exists in class %s', $getMethod, $isMethod, $class)); } } parent::__construct($class, $method, $property); }
/** * Adds a member metadata * * @param MemberMetadata $metadata */ protected function addMemberMetadata(MemberMetadata $metadata) { $property = $metadata->getPropertyName(); if (!isset($this->members[$property])) { $this->members[$property] = array(); } $this->members[$property][] = $metadata; }