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

votestack and comment add

This commit is contained in:
Tykayn 2021-04-29 11:48:38 +02:00 committed by tykayn
parent 80abd003ae
commit d885a3b947

View File

@ -3,6 +3,7 @@
namespace App\Controller\api;
use App\Controller\EmailsController;
use App\Entity\Comment;
use App\Entity\Owner;
use App\Entity\Poll;
use App\Entity\StackOfVotes;
@ -78,6 +79,13 @@ class VoteController extends EmailsController {
// TODO manage new comment
$emChoice = $choice_repository;
$newComment = new Comment();
$newComment->setPseudo($data ['pseudo'])
->setPoll($poll)
->setText($data['comment']);
$owner->addComment($newComment);
$em->persist($newComment);
foreach ( $data[ 'votes' ] as $vote ) {
if(!$vote[ 'value' ]){