Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace ACMEACMEBundleEntity;
- use DoctrineORMMapping as ORM;
- use DoctrineORMMappingJoinTable;
- use SymfonyComponentValidatorConstraints as Assert;
- class ActorSection
- {
- (...)
- /**
- * @ORMManyToMany(targetEntity="ACMEACMEBundleEntityPost")
- * @ORMjoinTable(name="actor_section_post")
- * @AssertCount(
- * min = "1",
- * minMessage = "Merci de sélectionner au moins un poste",
- * )
- */
- private $posts;
- (...)
- }
- $handleRequest = $form->handleRequest($request);
- if ($request->isMethod('POST')){
- if( ! $handleRequest->isValid()){
- $request->getSession()->getFlashBag()->add('danger', "Error message");
- } else{
- $em->persist($Section);
- $em->flush();
- (...)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement