本http://symfony.com/doc/current/reference/constraints/Choice.html#minで説明されている ように、「最小」オプションを使用して、少なくとも1つのチェックボックスが選択されている必要がある選択を検証したいと思います
フォームは次のようになります
->add('usergroups', 'entity', array('class' => 'PrUserBundle:Group','property' => 'name','required' => true, 'multiple' => true, 'expanded' => true))
私のvalidation.ymlは嘘に見えます:
Pr\UserBundle\Entity\User:
constraints:
//...
properties:
//.....
locations:
- Length:
min: 7 { message: "Please select at least one group." }
私はこれを行うのは完全に間違っていますが、本はこれ以上役に立たないので、あなたに尋ねます. または、True/False を使用する必要がありますか?