advance on fixtures

master
Tykayn 2 years ago committed by tykayn
parent 8bc01198b8
commit b6ca330826
  1. 1
      composer.json
  2. 160
      composer.lock
  3. 1
      config/bundles.php
  4. 3
      src/Controller/api/PollController.php
  5. 3
      src/DataFixtures/AppFixtures.php
  6. 6
      src/DataFixtures/AppPollFixtures.php
  7. 9
      src/DataFixtures/CommentFixtures.php
  8. 2
      src/DataFixtures/VotesStacksFixtures.php
  9. 15
      symfony.lock

@ -70,6 +70,7 @@
}
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
"symfony/maker-bundle": "^1.30"
}
}

160
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8c0122c4e542f317501dd66ea0f62a40",
"content-hash": "6ae23da7ab3d4ef4c0b8661a284d73c4",
"packages": [
{
"name": "composer/package-versions-deprecated",
@ -6374,6 +6374,164 @@
}
],
"packages-dev": [
{
"name": "doctrine/data-fixtures",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/data-fixtures.git",
"reference": "51d3d4880d28951fff42a635a2389f8c63baddc5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/51d3d4880d28951fff42a635a2389f8c63baddc5",
"reference": "51d3d4880d28951fff42a635a2389f8c63baddc5",
"shasum": ""
},
"require": {
"doctrine/common": "^2.13|^3.0",
"doctrine/persistence": "^1.3.3|^2.0",
"php": "^7.2 || ^8.0"
},
"conflict": {
"doctrine/phpcr-odm": "<1.3.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.2",
"doctrine/dbal": "^2.5.4",
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
"doctrine/orm": "^2.7.0",
"ext-sqlite3": "*",
"phpunit/phpunit": "^8.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
"doctrine/orm": "For loading ORM fixtures",
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Data Fixtures for all Doctrine Object Managers",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"database"
],
"support": {
"issues": "https://github.com/doctrine/data-fixtures/issues",
"source": "https://github.com/doctrine/data-fixtures/tree/1.5.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures",
"type": "tidelift"
}
],
"time": "2021-01-23T10:20:43+00:00"
},
{
"name": "doctrine/doctrine-fixtures-bundle",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
"reference": "870189619a7770f468ffb0b80925302e065a3b34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/870189619a7770f468ffb0b80925302e065a3b34",
"reference": "870189619a7770f468ffb0b80925302e065a3b34",
"shasum": ""
},
"require": {
"doctrine/data-fixtures": "^1.3",
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.6.0",
"doctrine/persistence": "^1.3.7|^2.0",
"php": "^7.1 || ^8.0",
"symfony/config": "^3.4|^4.3|^5.0",
"symfony/console": "^3.4|^4.3|^5.0",
"symfony/dependency-injection": "^3.4|^4.3|^5.0",
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0",
"symfony/http-kernel": "^3.4|^4.3|^5.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.4 || ^8.0 || ^9.2",
"symfony/phpunit-bridge": "^4.1|^5.0"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Doctrine\\Bundle\\FixturesBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Doctrine Project",
"homepage": "http://www.doctrine-project.org"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony DoctrineFixturesBundle",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"Fixture",
"persistence"
],
"support": {
"issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues",
"source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.4.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle",
"type": "tidelift"
}
],
"time": "2020-11-14T09:36:49+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.10.4",

@ -10,4 +10,5 @@ return [
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
];

@ -77,8 +77,7 @@ class PollController extends EmailsController {
* get a poll config by its custom URL, we do not want polls to be reachable by their numeric id
* @Get(
* path = "/{customUrl}",
* name = "get_poll",
* requirements = {"customUrl"="\w+"}
* name = "get_poll"
* )
*
* @param SerializerInterface $serializer

@ -3,7 +3,8 @@
namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
class AppFixtures extends Fixture
{

@ -10,7 +10,7 @@ use App\Entity\StackOfVotes;
use App\Entity\Vote;
use DateTime;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
class AppPollFixtures extends Fixture {
public function load( ObjectManager $manager ) {
@ -99,12 +99,14 @@ class AppPollFixtures extends Fixture {
$ownerComment = new Comment();
$ownerComment
->setText( "trop bien ce sondage wohooo! signé l'auteur." )
->setPseudo('un gens qui commente')
->setOwner( $owner );
$poll->addComment( $ownerComment );
$someoneComment = new Comment();
$someoneComment
->setText( "comme l'auteur se la raconte. PFFFF!" )
->setPseudo('un gens qui commente')
->setOwner( $commenterMan );
$poll->addComment( $someoneComment );
@ -169,11 +171,13 @@ class AppPollFixtures extends Fixture {
$someoneComment = new Comment();
$someoneComment
->setPseudo('un gens qui commente')
->setText( "allez boumbo!" )
->setOwner( $commenterMan );
$poll->addComment( $someoneComment );
$someoneComment2 = new Comment();
$someoneComment2
->setPseudo('un gens qui commente')
->setText( "je suis pour la team rocket de digimon" )
->setOwner( $owner );
$poll->addComment( $someoneComment2 );

@ -6,7 +6,7 @@ use App\Entity\Comment;
use App\Entity\Owner;
use App\Entity\Poll;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
class CommentFixtures extends Fixture {
public function load( ObjectManager $manager ) {
@ -20,9 +20,10 @@ class CommentFixtures extends Fixture {
->setPseudo( 'Wulfila' );
// comment on "citron ou orange"
$pollCitronOrange = $emPoll->find( 1 );
$pollCitronOrange = $emPoll->findOneByCustomUrl( 'citron' );
$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 );
@ -34,6 +35,7 @@ class CommentFixtures extends Fixture {
$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 );
@ -43,6 +45,7 @@ class CommentFixtures extends Fixture {
$comment = new Comment();
$comment->setOwner( $commenterMan )
->setPseudo( 'The Hayroule king' )
->setText( "Zelda. Orange." );
$pollCitronOrange->addComment( $comment );
$manager->persist( $comment );
@ -55,6 +58,7 @@ class CommentFixtures extends Fixture {
$poll = $emPoll->find( 3 );
$comment = new Comment();
$comment->setOwner( $commenterMan )
->setPseudo( 'The Hayroule king' )
->setText( "va pour demain" );
$pollCitronOrange->addComment( $comment );
$manager->persist( $comment );
@ -66,6 +70,7 @@ class CommentFixtures extends Fixture {
$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 );

@ -7,7 +7,7 @@ use App\Entity\Poll;
use App\Entity\StackOfVotes;
use App\Entity\Vote;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
class VotesStacksFixtures extends Fixture {
public function load( ObjectManager $manager ) {

@ -23,6 +23,9 @@
"doctrine/common": {
"version": "3.1.2"
},
"doctrine/data-fixtures": {
"version": "1.5.0"
},
"doctrine/dbal": {
"version": "2.13.0"
},
@ -45,6 +48,18 @@
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-fixtures-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.0",
"ref": "e5b542d4ef47d8a003c91beb35650c76907f7e53"
},
"files": [
"src/DataFixtures/AppFixtures.php"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "3.1",
"recipe": {

Loading…
Cancel
Save