我想一个布尔值传递给我的DogForm
访问通过
$dogForm = new DogForm(null, array("has_cats" => $this->getUser()->hasCats()));
$form = $this->createForm($dogForm, $dog);
在buildForm($选项)一个变量,但在我的DogForm
做时:
if (!isset($options['has_cats'])) {
throw new \Exception("Missing option has_cats, this option is mandatory");
}
它总是给我这个错误。
所以我知道狗不应该有猫,但是,我的has_cats
选项去?
谢谢。
谢谢克里斯。如果其他人知道他们是否阅读过这些内容,则必须在CatForm中的getDefaultOptions()中添加“has_cats”。 – 2012-01-02 15:32:12