date-poll-api/src/DataFixtures/AppPollFixtures.php

23 lines
513 B
PHP

<?php
namespace App\DataFixtures;
use App\Entity\Poll;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
class AppPollFixtures extends Fixture {
public function load( ObjectManager $manager ) {
// $product = new Product();
$poll = new Poll();
$poll->setTitle( 'démo sondage de texte' );
$poll->setCreationDate( new \DateTime() );
$poll->setExpiracyDate( new \DateTime( ( time() + 3600 * 24 ) ) );
$manager->persist( $poll );
$manager->flush();
}
}