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

90 lines
2.9 KiB
PHP
Raw Normal View History

2020-01-30 12:25:58 +01:00
<?php
namespace App\DataFixtures;
use App\Entity\Comment;
use App\Entity\Owner;
use App\Entity\Poll;
use Doctrine\Bundle\FixturesBundle\Fixture;
2021-04-21 11:30:22 +02:00
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
2021-04-21 11:22:01 +02:00
use Doctrine\Persistence\ObjectManager;
2020-01-30 12:25:58 +01:00
2021-04-21 11:30:22 +02:00
class CommentFixtures extends Fixture implements DependentFixtureInterface {
2021-04-21 11:44:06 +02:00
public function getDependencies() {
2021-04-21 11:30:22 +02:00
return [
AppPollFixtures::class,
];
}
2020-01-30 12:25:58 +01:00
public function load( ObjectManager $manager ) {
$emPoll = $manager->getRepository( Poll::class );
$commenterMan = new Owner();
$commenterMan->setEmail( 'tktest_commentateur_other@tktest.com' )
->setPseudo( 'Bill Murray' );
$commenterMan2 = new Owner();
$commenterMan2->setEmail( 'wulfila@tktest.com' )
->setPseudo( 'Wulfila' );
// comment on "citron ou orange"
2021-04-21 11:44:06 +02:00
$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();
2021-04-21 11:22:50 +02:00
2021-04-21 11:44:06 +02:00
// 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 );
2021-04-21 11:22:50 +02:00
2020-01-30 12:25:58 +01:00
$manager->flush();
}
}