You are here

public function Constraint::__get in Plug 7

Returns 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.

@internal This method should not be used or overwritten in userland code.

@since 2.6

Parameters

string $option The option name:

Return value

mixed The value of the option

Throws

InvalidOptionsException If an invalid option name is given

File

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

Class

Constraint
Contains the properties of a constraint definition.

Namespace

Symfony\Component\Validator

Code

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