format dates in fixtures

This commit is contained in:
tykayn 2019-11-29 10:19:12 +01:00
parent 3cac2ac979
commit 2440c739e2
2 changed files with 5 additions and 4 deletions

3
.env
View File

@ -25,5 +25,6 @@ APP_SECRET=597b0529ac702d27dcb9089f7e69c362
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11"
# IMPORTANT: You MUST also configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
DATABASE_URL=mysql://root:plopplop01@127.0.0.1:3306/tykayn
###< doctrine/doctrine-bundle ###

View File

@ -175,11 +175,11 @@ class AppPollFixtures extends Fixture {
$poll = new Poll();
$choice = new Choice();
$firstDate = new DateTime();
$choice->setName( $firstDate );
$choice->setName( $firstDate->format( 'Y-m-d H:i:s' ) );
$choice2 = new Choice();
$choice3 = new Choice();
$choice2->setName( $poll->addDaysToDate( $firstDate, 1 ) );
$choice3->setName( $poll->addDaysToDate( $firstDate, 2 ) );
$choice2->setName( $poll->addDaysToDate( $firstDate, 1 )->format( 'Y-m-d H:i:s' ) );
$choice3->setName( $poll->addDaysToDate( $firstDate, 2 )->format( 'Y-m-d H:i:s' ) );
$poll->setTitle( "c'est pour aujourdhui ou pour demain" )
->setDescription( 'Vous avez le choix dans la date' )