diff --git a/src/Autocomplete/src/Form/WrappedEntityTypeAutocompleter.php b/src/Autocomplete/src/Form/WrappedEntityTypeAutocompleter.php index bf181c9f618..66615bda0fd 100644 --- a/src/Autocomplete/src/Form/WrappedEntityTypeAutocompleter.php +++ b/src/Autocomplete/src/Form/WrappedEntityTypeAutocompleter.php @@ -172,6 +172,10 @@ private function getEntityMetadata(): EntityMetadata public function setOptions(array $options): void { + if (null !== $this->form) { + throw new \LogicException('The options can only be set before the form is created.'); + } + $this->options = $options; } }