I want to pass a boolean to my DogForm
$dogForm = new DogForm(null, array("has_cats" => $this->getUser()->hasCats()));
$form = $this->createForm($dogForm, $dog);
But when doing in my DogForm :
if (!isset($options['has_cats'])) {
throw new \Exception("Missing option has_cats, this option is mandatory");
}
It always give me this error.
So i know that dogs aren’t supposed to have cats but, where my has_cats option went ?
Thanks.
Options should be passed to the
createForm()method, not to yourDogFormconstructor:Mind, that you have to add “has_cats” to
getDefaultOptions()as well