示例#1
0
 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);
     }
 }
示例#2
0
 /**
  * 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);
 }
示例#3
0
 /**
  * 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);
 }
示例#4
0
 /**
  * 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;
 }