1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

cration of poll up answers possible

This commit is contained in:
Baptiste Lemoine 2020-01-23 15:13:51 +01:00
parent 4de3dd7ca3
commit 4ff254d54a
2 changed files with 16 additions and 0 deletions

View File

@ -162,6 +162,20 @@ class DefaultController extends AbstractController {
$em->persist( $newpoll ); $em->persist( $newpoll );
$em->persist( $foundOwner ); $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 // setup the password, converting the raw with md5 hash
if ( $data[ 'password' ] ) { if ( $data[ 'password' ] ) {
$newpoll->setPassword( $data[ 'password' ] ); $newpoll->setPassword( $data[ 'password' ] );

View File

@ -112,6 +112,7 @@ class Poll {
public $showResultEvenIfPasswords; public $showResultEvenIfPasswords;
/** /**
* @ORM\OneToMany(targetEntity="App\Entity\Vote", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"}) * @ORM\OneToMany(targetEntity="App\Entity\Vote", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"})
* @Serializer\Type("App\Entity\Vote")
* @Serializer\Expose() * @Serializer\Expose()
*/ */
public $votes; public $votes;
@ -128,6 +129,7 @@ class Poll {
/** /**
* @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"}) * @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="poll", orphanRemoval=true, cascade={"persist", "remove"})
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Type("App\Entity\Comment")
*/ */
public $comments; public $comments;
/** /**