setEmail( 'tktest@tktest.com' ) ->setPseudo( 'tk_TEST' ); $commenterMan = new Owner(); $commenterMan->setEmail( 'tktest_commentateur@tktest.com' ) ->setPseudo( 'tk_TEST_commentateur' ); $voter = new Owner(); $voter->setEmail( 'testing_vote_people@tktest.com' ) ->setPseudo( 'voting_people_TEST' ) ->setModifierToken( uniqid() ); $poll = new Poll(); $poll->setTitle( 'citron ou orange' ); $poll->setKind( 'text' ); $poll->setDescription( 'votre sorbert préféré' ); $poll->setAdminKey( uniqid() ); $poll->setModificationPolicy( 'nobody' ); $poll->setExpiracyDate( new DateTime() ); $poll->setMailOnVote( true ); $poll->setOwner( $owner ); $owner->addPoll( $poll ); $choiceA = new Choice(); $choiceA->setName( 'citron' ); $choiceB = new Choice(); $choiceA->setName( 'orange' ); $poll ->addChoice( $choiceA ) ->addChoice( $choiceB ); $voteA = new Vote(); $voteA->setPseudo( 'chuck norris' ) ->setChoice( $choiceA ); $voteA = new Vote(); $voteA->setPseudo( 'Néo' ) ->setChoice( $choiceB ); $manager->persist( $poll ); $poll = new Poll(); $ownerComment = new Comment(); $ownerComment ->setText( "trop bien ce sondage wohooo! signé l'auteur." ) ->setOwner( $owner ); $poll->addComment( $ownerComment ); $someoneComment = new Comment(); $someoneComment ->setText( "comme l'auteur se la raconte. PFFFF!" ) ->setOwner( $commenterMan ); $poll->addComment( $someoneComment ); $poll->setTitle( 'démo sondage de texte avec deux commentaires' ); $poll->setDescription( 'description du sondage 2' ); $poll->setKind( 'text' ); $poll->setAdminKey( uniqid() ); $poll->setModificationPolicy( 'self' ); $poll->setMailOnComment( true ); $poll->setExpiracyDate( new DateTime() ); $poll->addTextChoiceArray( [ 'un truc', 'deux trucs' ] ); $poll->setOwner( $owner ); $owner->addPoll( $poll ); $manager->persist( $poll ); $manager->persist( $someoneComment ); $manager->persist( $ownerComment ); // voting test with 2 people // $stack1 = new StackOfVotes(); // $vote0 = new Vote(); // $vote0->setChoice( $poll->getChoices()[ 0 ] ); // $stack1->setOwner( $voter ) // ->addVote( $vote0 ); // // $stack2 = new StackOfVotes(); // $vote1 = new Vote(); // $vote1 // ->setChoice( $poll->getChoices()[ 1 ] ); // $stack1 // ->setOwner( $owner ) // ->addVote( $vote1 ); // // // $voter->addStackOfVote( $stack1 ); // $owner->addStackOfVote( $stack2 ); // // $poll = new Poll(); // $poll->setTitle( 'accès restreint sondage de texte' ); // $poll->setKind( 'text' ); // $poll->setPassword( md5( 'mot_de_passe_super' ) ); // $poll->setModificationPolicy( 'everybody' ); // $poll->setDescription( 'description du sondage a accès restreint. le mot de passe est mot_de_passe_super' ); // $poll->setAdminKey( uniqid() ); // $poll->setCustomUrl( 'boudoum_podom_podom' ); // // $poll->setExpiracyDate( new DateTime() ); // $poll->setMailOnComment( true ); // $poll->setMailOnVote( true ); // $poll->setOwner( $owner ); // $owner->addPoll( $poll ); // // $manager->persist( $vote1 ); // $manager->persist( $vote0 ); // $manager->persist( $stack1 ); // $manager->persist( $stack2 ); // $manager->persist( $poll ); // $manager->persist( $owner ); // $manager->persist( $voter ); // poll with date type $poll = new Poll(); $choice = new Choice(); $firstDate = new DateTime(); $choice->setName( $firstDate ); $choice2 = new Choice(); $choice3 = new Choice(); $choice2->setName( $poll->addDaysToDate( $firstDate, 1 ) ); $choice3->setName( $poll->addDaysToDate( $firstDate, 2 ) ); $poll->setTitle( "c'est pour aujourdhui ou pour demain" ) ->setDescription( 'Vous avez le choix dans la date' ) ->setExpiracyDate( new DateTime() ) ->setKind( 'date' ) ->setOwner( $owner ) ->addChoice( $choice ) ->addChoice( $choice2 ) ->setModificationPolicy( 'self' ); // poll with cartoon choices $poll = new Poll(); $poll->setTitle( 'dessin animé préféré' ) ->setDescription( 'choisissez votre animé préféré' ) ->setExpiracyDate( new DateTime() ) ->setKind( 'text' ) ->setOwner( $owner ) ->setModificationPolicy( 'self' ) ->addTextChoiceArray( [ "Vic le viking", "Boumbo petite automobile", "Les mystérieuses cités d'or", "Les mondes engloutis", "Foot 2 rue", "Le chat, la vache, et l'océan", "Digimon", ] ); $manager->persist( $poll ); $manager->persist( $commenterMan ); $manager->flush(); } }