Symfony2+Doctrine - Validating one-to-many collection of entities

后端 未结 4 712
一整个雨季
一整个雨季 2020-12-29 09:33

I have a form to create a new entity. That entity has a collection of other entities that are also entered in that form.

I want to use the validation options of the

4条回答
  •  生来不讨喜
    2020-12-29 10:00

    Just add annotation assert like following

    /** 
     * @Assert\Count(
     *      min = "1",
     *      minMessage = "You must specify at least one"
     * )
     * @Assert\Valid 
     * 
     */
    protected $name_of_collection_property;
    

提交回复
热议问题