mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
get protected pass route works
This commit is contained in:
parent
1570a1cf0f
commit
2d2607d30b
@ -135,7 +135,6 @@ class PollController extends EmailsController {
|
||||
* @Get(
|
||||
* path = "/{customUrl}/pass/{md5}",
|
||||
* name = "get_protected_poll",
|
||||
* requirements = {"customUrl"="\w+"}
|
||||
* )
|
||||
*
|
||||
* @param SerializerInterface $serializer
|
||||
@ -143,12 +142,12 @@ class PollController extends EmailsController {
|
||||
*
|
||||
* @return JsonResponse|Response
|
||||
*/
|
||||
function getProtectedPoll($id,$md5, SerializerInterface $serializer){
|
||||
function getProtectedPoll($customUrl,$md5, SerializerInterface $serializer){
|
||||
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
||||
$poll = $repository->findOneByCustomUrl( $id );
|
||||
$poll = $repository->findOneByCustomUrl( $customUrl );
|
||||
|
||||
if ( ! $poll ) {
|
||||
return $this->notFoundPoll($id);
|
||||
return $this->notFoundPoll($customUrl);
|
||||
}
|
||||
|
||||
if ( $poll->getPassword() === $md5 ) {
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class CommentFixtures extends Fixture implements DependentFixtureInterface {
|
||||
public function getDependencies()
|
||||
{
|
||||
public function getDependencies() {
|
||||
return [
|
||||
AppPollFixtures::class,
|
||||
];
|
||||
@ -28,66 +27,63 @@ class CommentFixtures extends Fixture implements DependentFixtureInterface {
|
||||
->setPseudo( 'Wulfila' );
|
||||
|
||||
// comment on "citron ou orange"
|
||||
$pollCitronOrange = $this->getReference(AppPollFixtures::POLL_FIXTURE_ONE);
|
||||
if ( $pollCitronOrange ) {
|
||||
$pollCitronOrange = $this->getReference( AppPollFixtures::POLL_FIXTURE_ONE );
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan )
|
||||
->setPseudo( 'the indécis people' )
|
||||
->setText( 'quelle indécision wololo! finalement citron. heu non orange. AAAAh!' );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $pollCitronOrange );
|
||||
$manager->persist( $commenterMan );
|
||||
$manager->flush();
|
||||
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan )
|
||||
->setPseudo( 'the indécis people' )
|
||||
->setText( 'quelle indécision wololo! finalement citron. heu non orange. AAAAh!' );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $pollCitronOrange );
|
||||
$manager->persist( $commenterMan );
|
||||
$manager->flush();
|
||||
// comment on "démo sondage de texte avec deux commentaires"
|
||||
// $poll = $emPoll->find( 2 );
|
||||
// $comment = new Comment();
|
||||
// $comment->setOwner( $commenterMan2 )
|
||||
// ->setPseudo( 'The Hayroule king' )
|
||||
// ->setText( 'il est écrit Squalala.' );
|
||||
// $pollCitronOrange->addComment( $comment );
|
||||
// $manager->persist( $comment );
|
||||
// $manager->persist( $poll );
|
||||
// $manager->persist( $commenterMan2 );
|
||||
// $manager->flush();
|
||||
//
|
||||
// $comment = new Comment();
|
||||
// $comment->setOwner( $commenterMan )
|
||||
// ->setPseudo( 'The Hayroule king' )
|
||||
// ->setText( "Zelda. Orange." );
|
||||
// $pollCitronOrange->addComment( $comment );
|
||||
// $manager->persist( $comment );
|
||||
// $manager->persist( $poll );
|
||||
// $manager->persist( $commenterMan );
|
||||
// $manager->flush();
|
||||
//
|
||||
//
|
||||
// // comment on "c'est pour aujourdhui ou pour demain"
|
||||
// $poll = $emPoll->find( 3 );
|
||||
// $comment = new Comment();
|
||||
// $comment->setOwner( $commenterMan )
|
||||
// ->setPseudo( 'The Hayroule king' )
|
||||
// ->setText( "va pour demain" );
|
||||
// $pollCitronOrange->addComment( $comment );
|
||||
// $manager->persist( $comment );
|
||||
// $manager->persist( $poll );
|
||||
// $manager->persist( $commenterMan );
|
||||
// $manager->flush();
|
||||
//
|
||||
// // comment on "dessin animé préféré"
|
||||
// $poll = $emPoll->find( 4 );
|
||||
// $comment = new Comment();
|
||||
// $comment->setOwner( $commenterMan2 )
|
||||
// ->setPseudo( 'The Hayroule king' )
|
||||
// ->setText( "Ceci est un commentaire de fixture créé avec le CipherBliss poweur." );
|
||||
// $pollCitronOrange->addComment( $comment );
|
||||
// $manager->persist( $comment );
|
||||
// $manager->persist( $poll );
|
||||
// $manager->persist( $commenterMan2 );
|
||||
|
||||
// comment on "démo sondage de texte avec deux commentaires"
|
||||
$poll = $emPoll->find( 2 );
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan2 )
|
||||
->setPseudo( 'The Hayroule king' )
|
||||
->setText( 'il est écrit Squalala.' );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $commenterMan2 );
|
||||
$manager->flush();
|
||||
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan )
|
||||
->setPseudo( 'The Hayroule king' )
|
||||
->setText( "Zelda. Orange." );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $commenterMan );
|
||||
$manager->flush();
|
||||
|
||||
|
||||
// comment on "c'est pour aujourdhui ou pour demain"
|
||||
$poll = $emPoll->find( 3 );
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan )
|
||||
->setPseudo( 'The Hayroule king' )
|
||||
->setText( "va pour demain" );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $commenterMan );
|
||||
$manager->flush();
|
||||
|
||||
// comment on "dessin animé préféré"
|
||||
$poll = $emPoll->find( 4 );
|
||||
$comment = new Comment();
|
||||
$comment->setOwner( $commenterMan2 )
|
||||
->setPseudo( 'The Hayroule king' )
|
||||
->setText( "Ceci est un commentaire de fixture créé avec le CipherBliss poweur." );
|
||||
$pollCitronOrange->addComment( $comment );
|
||||
$manager->persist( $comment );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $commenterMan2 );
|
||||
|
||||
}
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,18 @@ use App\Entity\Poll;
|
||||
use App\Entity\StackOfVotes;
|
||||
use App\Entity\Vote;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class VotesStacksFixtures extends Fixture {
|
||||
class VotesStacksFixtures extends Fixture implements DependentFixtureInterface {
|
||||
public function getDependencies()
|
||||
{
|
||||
return [
|
||||
AppPollFixtures::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function load( ObjectManager $manager ) {
|
||||
$emPoll = $manager->getRepository( Poll::class );
|
||||
|
||||
$people1 = new Owner();
|
||||
$people1->setEmail( 'tktest_nikolas_edison@tktest.com' )
|
||||
@ -24,124 +31,127 @@ class VotesStacksFixtures extends Fixture {
|
||||
->setPseudo( 'Billie Jean' );
|
||||
|
||||
// "citron ou orange"
|
||||
$poll = $emPoll->find( 1 );
|
||||
// add vote stacks on "citron ou orange"
|
||||
$pollCitronOrange = $this->getReference(AppPollFixtures::POLL_FIXTURE_ONE);
|
||||
$stack1 = new StackOfVotes();
|
||||
$stack1
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setOwner( $people1 );
|
||||
$voteA = new Vote();
|
||||
$voteA
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setStacksOfVotes( $stack1 )
|
||||
->setValue( "yes" )
|
||||
->setChoice( $poll->getChoices()[ 0 ] );
|
||||
->setChoice( $pollCitronOrange->getChoices()[ 0 ] );
|
||||
$voteB = new Vote();
|
||||
$voteB
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setStacksOfVotes( $stack1 )
|
||||
->setValue( "maybe" )
|
||||
->setChoice( $poll->getChoices()[ 1 ] );
|
||||
$poll->addStackOfVote( $stack1 );
|
||||
$manager->persist( $poll );
|
||||
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||
$pollCitronOrange->addStackOfVote( $stack1 );
|
||||
$manager->persist( $pollCitronOrange );
|
||||
$manager->persist( $people1 );
|
||||
$manager->persist( $stack1 );
|
||||
|
||||
$stack2 = new StackOfVotes();
|
||||
$stack2
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setOwner( $people2 );
|
||||
$voteA = new Vote();
|
||||
$voteA
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setStacksOfVotes( $stack2 )
|
||||
->setValue( "no" )
|
||||
->setChoice( $poll->getChoices()[ 0 ] );
|
||||
->setChoice( $pollCitronOrange->getChoices()[ 0 ] );
|
||||
$voteB = new Vote();
|
||||
$voteB
|
||||
->setPoll( $poll )
|
||||
->setPoll( $pollCitronOrange )
|
||||
->setStacksOfVotes( $stack2 )
|
||||
->setValue( "yes" )
|
||||
->setChoice( $poll->getChoices()[ 1 ] );
|
||||
$poll->addStackOfVote( $stack2 );
|
||||
$manager->persist( $poll );
|
||||
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||
$pollCitronOrange->addStackOfVote( $stack2 );
|
||||
$manager->persist( $pollCitronOrange );
|
||||
$manager->persist( $stack2 );
|
||||
$manager->persist( $people2 );
|
||||
|
||||
|
||||
// $stack1 = new StackOfVotes();
|
||||
// $stack1
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setOwner( $people1 );
|
||||
// $voteA = new Vote();
|
||||
// $voteA
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack1 )
|
||||
// ->setValue( "maybe" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 2 ] );
|
||||
// $voteB = new Vote();
|
||||
// $voteB
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack1 )
|
||||
// ->setValue( "maybe" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 4 ] );
|
||||
// $pollCitronOrange->addStackOfVote( $stack1 );
|
||||
// $manager->persist( $pollCitronOrange );
|
||||
// $manager->persist( $people1 );
|
||||
// $manager->persist( $stack1 );
|
||||
//
|
||||
//
|
||||
// $stack2 = new StackOfVotes();
|
||||
// $stack2
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setOwner( $people2 );
|
||||
// $voteA = new Vote();
|
||||
// $voteA
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack2 )
|
||||
// ->setValue( "maybe" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 3 ] );
|
||||
// $voteB = new Vote();
|
||||
// $voteB
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack2 )
|
||||
// ->setValue( "yes" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 5 ] );
|
||||
// $pollCitronOrange->addStackOfVote( $stack2 );
|
||||
// $manager->persist( $pollCitronOrange );
|
||||
// $manager->persist( $people2 );
|
||||
// $manager->persist( $stack2 );
|
||||
//
|
||||
//
|
||||
// $stack3 = new StackOfVotes();
|
||||
// $stack3
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setOwner( $people3 );
|
||||
// $voteA = new Vote();
|
||||
// $voteA
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack3 )
|
||||
// ->setValue( "yes" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||
// $voteB = new Vote();
|
||||
// $voteB
|
||||
// ->setPoll( $pollCitronOrange )
|
||||
// ->setStacksOfVotes( $stack3 )
|
||||
// ->setValue( "yes" )
|
||||
// ->setChoice( $pollCitronOrange->getChoices()[ 3 ] );
|
||||
// $pollCitronOrange->addStackOfVote( $stack3 );
|
||||
// $manager->persist( $pollCitronOrange );
|
||||
// $manager->persist( $people3 );
|
||||
// $manager->persist( $stack3 );
|
||||
|
||||
|
||||
// comment on "démo sondage de texte avec deux commentaires"
|
||||
$poll = $emPoll->find( 2 );
|
||||
|
||||
|
||||
// comment on "c'est pour aujourdhui ou pour demain"
|
||||
$poll = $emPoll->find( 3 );
|
||||
|
||||
|
||||
// comment on "dessin animé préféré"
|
||||
$poll = $emPoll->find( 4 );
|
||||
|
||||
$stack1 = new StackOfVotes();
|
||||
$stack1
|
||||
->setPoll( $poll )
|
||||
->setOwner( $people1 );
|
||||
$voteA = new Vote();
|
||||
$voteA
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack1 )
|
||||
->setValue( "maybe" )
|
||||
->setChoice( $poll->getChoices()[ 2 ] );
|
||||
$voteB = new Vote();
|
||||
$voteB
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack1 )
|
||||
->setValue( "maybe" )
|
||||
->setChoice( $poll->getChoices()[ 4 ] );
|
||||
$poll->addStackOfVote( $stack1 );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $people1 );
|
||||
$manager->persist( $stack1 );
|
||||
|
||||
|
||||
$stack2 = new StackOfVotes();
|
||||
$stack2
|
||||
->setPoll( $poll )
|
||||
->setOwner( $people2 );
|
||||
$voteA = new Vote();
|
||||
$voteA
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack2 )
|
||||
->setValue( "maybe" )
|
||||
->setChoice( $poll->getChoices()[ 3 ] );
|
||||
$voteB = new Vote();
|
||||
$voteB
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack2 )
|
||||
->setValue( "yes" )
|
||||
->setChoice( $poll->getChoices()[ 5 ] );
|
||||
$poll->addStackOfVote( $stack2 );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $people2 );
|
||||
$manager->persist( $stack2 );
|
||||
|
||||
|
||||
$stack3 = new StackOfVotes();
|
||||
$stack3
|
||||
->setPoll( $poll )
|
||||
->setOwner( $people3 );
|
||||
$voteA = new Vote();
|
||||
$voteA
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack3 )
|
||||
->setValue( "yes" )
|
||||
->setChoice( $poll->getChoices()[ 1 ] );
|
||||
$voteB = new Vote();
|
||||
$voteB
|
||||
->setPoll( $poll )
|
||||
->setStacksOfVotes( $stack3 )
|
||||
->setValue( "yes" )
|
||||
->setChoice( $poll->getChoices()[ 3 ] );
|
||||
$poll->addStackOfVote( $stack3 );
|
||||
$manager->persist( $poll );
|
||||
$manager->persist( $people3 );
|
||||
$manager->persist( $stack3 );
|
||||
// $poll = $emPoll->find( 2 );
|
||||
//
|
||||
//
|
||||
// // comment on "c'est pour aujourdhui ou pour demain"
|
||||
// $poll = $emPoll->find( 3 );
|
||||
//
|
||||
//
|
||||
// // comment on "dessin animé préféré"
|
||||
// $poll = $emPoll->find( 4 );
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user