示例#1
0
 /**
  * {@inheritDoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if ($constraint instanceof Valid) {
         throw new ConstraintDefinitionException('The constraint Valid can only be put on properties or getters');
     }
     $constraint->addImplicitGroupName($this->getDefaultGroup());
     parent::addConstraint($constraint);
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if ($constraint instanceof Valid) {
         $this->cascaded = true;
     } else {
         parent::addConstraint($constraint);
     }
     return $this;
 }
示例#3
0
 /**
  * {@inheritDoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->targets())) {
         throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', get_class($constraint)));
     }
     if ($constraint instanceof Valid) {
         $this->cascaded = true;
     } else {
         parent::addConstraint($constraint);
     }
     return $this;
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) {
         throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on classes', get_class($constraint)));
     }
     $constraint->addImplicitGroupName($this->getDefaultGroup());
     parent::addConstraint($constraint);
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) {
         throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', get_class($constraint)));
     }
     parent::addConstraint($constraint);
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) {
         throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', get_class($constraint)));
     }
     if ($constraint instanceof Valid) {
         throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', get_class($constraint)));
     }
     if ($constraint instanceof Traverse) {
         if ($constraint->traverse) {
             // If traverse is true, traversal should be explicitly enabled
             $this->traversalStrategy = TraversalStrategy::TRAVERSE;
         } else {
             // If traverse is false, traversal should be explicitly disabled
             $this->traversalStrategy = TraversalStrategy::NONE;
         }
         // The constraint is not added
         return $this;
     }
     $constraint->addImplicitGroupName($this->getDefaultGroup());
     parent::addConstraint($constraint);
     return $this;
 }
示例#7
0
 /**
  * {@inheritDoc}
  */
 public function addConstraint(Constraint $constraint)
 {
     $constraint->addImplicitGroupName($this->getShortClassName());
     parent::addConstraint($constraint);
 }