votestack and comment add
This commit is contained in:
parent
80abd003ae
commit
d885a3b947
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Controller\api;
|
namespace App\Controller\api;
|
||||||
|
|
||||||
use App\Controller\EmailsController;
|
use App\Controller\EmailsController;
|
||||||
|
use App\Entity\Comment;
|
||||||
use App\Entity\Owner;
|
use App\Entity\Owner;
|
||||||
use App\Entity\Poll;
|
use App\Entity\Poll;
|
||||||
use App\Entity\StackOfVotes;
|
use App\Entity\StackOfVotes;
|
||||||
|
@ -78,6 +79,13 @@ class VoteController extends EmailsController {
|
||||||
|
|
||||||
// TODO manage new comment
|
// TODO manage new comment
|
||||||
$emChoice = $choice_repository;
|
$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 ) {
|
foreach ( $data[ 'votes' ] as $vote ) {
|
||||||
if(!$vote[ 'value' ]){
|
if(!$vote[ 'value' ]){
|
||||||
|
|
Loading…
Reference in New Issue