Skip to content
Snippets Groups Projects
Commit 20c8ed0b authored by Camille Simiand's avatar Camille Simiand Committed by Sebastien
Browse files

Add Capsule fixtures

parent 8fe6dabb
No related branches found
No related tags found
3 merge requests!43tuleap-83-access-my-capsules,!42Draft: access-my-capsules-conflicts-fixed,!40Draft: Tuleap 83 access my capsules
<?php
namespace App\DataFixtures;
use App\Entity\Capsule;
use DateTime;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class AppCapsuleFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$this->createCapsuleWithData(
$manager,
'anonymous',
new DateTime(),
'https://youtu.be/oPmMUZbnc3o',
'Adele',
'',
'',
new DateTime()
);
$this->createCapsuleWithData(
$manager,
'Camille',
new DateTime(),
'https://youtu.be/-xulsY5AGew',
'Pomme',
'',
'',
new DateTime()
);
$manager->flush();
}
private function createCapsuleWithData(
ObjectManager $manager,
string $author,
DateTime $date_time,
string $link,
string $name,
string $edition_link,
string $update_author,
?DateTime $update_datetime
): void {
$capsule = new Capsule();
$capsule->setAuthor($author);
$capsule->setCreationDate($date_time);
$capsule->setLink($link);
$capsule->setEditionLink($edition_link);
$capsule->setName($name);
$capsule->setUpdateAuthor($update_author);
$capsule->setUpdateDate($update_datetime);
$manager->persist($capsule);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment