Symfony\Component\Validator\Constraint::addImplicitGroupName PHP Method

addImplicitGroupName() public method

Adds the given group if this constraint is in the Default group
public addImplicitGroupName ( string $group )
$group string
    public function addImplicitGroupName($group)
    {
        if (in_array(Constraint::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) {
            $this->groups[] = $group;
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Adds a constraint to the getter of the given property.
  *
  * The name of the getter is assumed to be the name of the property with an
  * uppercased first letter and either the prefix "get" or "is".
  *
  * @param string     $property   The name of the property
  * @param Constraint $constraint The constraint
  *
  * @return ClassMetadata This object
  */
 public function addGetterConstraint($property, Constraint $constraint)
 {
     if (!isset($this->getters[$property])) {
         $this->getters[$property] = new GetterMetadata($this->getClassName(), $property);
         $this->addMemberMetadata($this->getters[$property]);
     }
     $constraint->addImplicitGroupName($this->getDefaultGroup());
     $this->getters[$property]->addConstraint($constraint);
     return $this;
 }
All Usage Examples Of Symfony\Component\Validator\Constraint::addImplicitGroupName