2
任何人都可以告訴我爲什麼與表單集合相關的錯誤在特定字段外部顯示,以及如何將它移動到您在以下圖像中看到的位置?Symfony 3 - 在字段外部顯示錶單集合字段錯誤
本場代碼:
/**
* @Assert\Valid
* @ORM\OneToMany(
* targetEntity="PageFile",
* mappedBy="page",
* cascade={"persist","remove"},
* orphanRemoval=true
*)
* @var PageFile[]
* @Assert\Count(max="1")
*/
private $pageFiles;
配置:
- property: 'pageFiles'
type: 'collection'
type_options:
entry_type: 'Notimeo\PageBundle\Form\Type\MyFileType'
by_reference: false
error_bubbling: false
我使用EasyAdminBundle這是我的整個項目:https://github.com/ktrzos/SymfonyBasic。問題適用於「Notimeo \ PageBundle」。
'選項 「cascade_validation」 不exist.' –
我看到,海報正在使用Symfony 2.1。我在這裏使用Symfony 3.0.1。它可以有所作爲。 –
它看起來像在Symfony3中被刪除了,我不知道你使用的是什麼版本。請參閱Symfony 2.8 doc:http://symfony.com/doc/2.8/reference/forms/types/form.html#cascade-validation。他們建議使用有效約束,而不是http://symfony.com/doc/current/reference/constraints/Valid.html – martin