From 4ff254d54adcaca3b65a1c577389b11b094596ef Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Thu, 23 Jan 2020 15:13:51 +0100 Subject: [PATCH] cration of poll up answers possible --- src/Controller/DefaultController.php | 14 ++++++++++++++ src/Entity/Poll.php | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index aee5a26..0cbbf24 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -162,6 +162,20 @@ class DefaultController extends AbstractController { $em->persist( $newpoll ); $em->persist( $foundOwner ); + // emails + $newpoll->setMailOnComment( true ); + $newpoll->setMailOnVote( true ); + $newpoll->setHideResults( false ); + // possible answers + $newpoll->setAllowedAnswers( [ 'yes' ] ); + if ( $data[ 'voteChoices' ] ) { + switch ( $data[ 'voteChoices' ] ) { + case "only_yes": + default: + + break; + } + } // setup the password, converting the raw with md5 hash if ( $data[ 'password' ] ) { $newpoll->setPassword( $data[ 'password' ] ); diff --git a/src/Entity/Poll.php b/src/Entity/Poll.php index b85501b..c1d1f8c 100644 --- a/src/Entity/Poll.php +++ b/src/Entity/Poll.php @@ -112,6 +112,7 @@ class Poll { public $showResultEvenIfPasswords; /** * @ORM\OneToMany(targetEntity="App\Entity\Vote", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"}) + * @Serializer\Type("App\Entity\Vote") * @Serializer\Expose() */ public $votes; @@ -128,6 +129,7 @@ class Poll { /** * @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"}) * @Serializer\Expose() + * @Serializer\Type("App\Entity\Comment") */ public $comments; /**