function importValue($value) { if (!in_array($value, $this->getAvailableValues())) { $value = null; $this->setError(FormControlError::invalid()); } if (!$value && !$this->isOptional()) { $this->setError(FormControlError::missing()); } return parent::importValue($value); }
function __construct($name, $label) { Assert::isTrue(preg_match(FormControlSet::NAME_PATTERN, $name), 'name of a set should contain alphanumeric symbols, glyphs and underscored only'); parent::__construct($name, $label); }