public function validate($value, Constraint
$constraint) { $typed_data =
$this->
getTypedData();
if ($typed_data instanceof OptionsProviderInterface
) { $allowed_values =
$typed_data->
getSettableValues($this->currentUser
);
$constraint->choices =
$allowed_values;
// If the data is complex, we have to validate its main property.
if ($typed_data instanceof ComplexDataInterface
) { $name =
$typed_data->
getDataDefinition()->
getMainPropertyName();
if (!
isset($name)) { throw new \
LogicException('Cannot validate allowed values for complex data without a main property.'
);
} $typed_data =
$typed_data->
get($name);
$value =
$typed_data->
getValue();
} } // The parent implementation ignores values that are not set, but makes
// sure some choices are available firstly. However, we want to support
// empty choices for undefined values; for instance, if a term reference