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); }