diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 637438f85..da4befeb1 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -29,6 +29,7 @@ use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\HasScopeInterface; use Doctrine\Common\Collections\ArrayCollection; use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency; +use Symfony\Component\Validator\Constraints as Assert; /** * Activity @@ -72,6 +73,8 @@ class Activity implements HasCenterInterface, HasScopeInterface /** * @var \Doctrine\Common\Collections\Collection + * + * @Assert\Count(min=1, minMessage="Add at least one reason") */ private $reasons; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 407ceaa70..53404a0fc 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -99,11 +99,11 @@ class ActivityType extends AbstractType )) ->add('attendee', ChoiceType::class, array( 'expanded' => true, - 'required' => false, + 'required' => true, 'choices_as_values' => true, 'choices' => array( - 'present' => true, - 'not present' => false + 'yes' => true, + 'no' => false ) )) ->add('user', UserPickerType::class, [ diff --git a/src/Bundle/ChillActivityBundle/Resources/translations/validators.fr.yml b/src/Bundle/ChillActivityBundle/Resources/translations/validators.fr.yml index edda0b67b..173a11e77 100644 --- a/src/Bundle/ChillActivityBundle/Resources/translations/validators.fr.yml +++ b/src/Bundle/ChillActivityBundle/Resources/translations/validators.fr.yml @@ -1,2 +1,3 @@ The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide At least one reason must be choosen: Au moins un sujet doit être choisi +Add at least one reason: L'activité doit comporter au moins un sujet