You are here

public function Constraint::__set in Plug 7

Sets the value of a lazily initialized option.

Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name.

Parameters

string $option The option name:

mixed $value The value to set:

Throws

InvalidOptionsException If an invalid option name is given

File

lib/Symfony/validator/Symfony/Component/Validator/Constraint.php, line 187

Class

Constraint
Contains the properties of a constraint definition.

Namespace

Symfony\Component\Validator

Code

public function __set($option, $value) {
  if ('groups' === $option) {
    $this->groups = (array) $value;
    return;
  }
  throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array(
    $option,
  ));
}