Ajout endpoint API /projects + fixtures Project

This commit is contained in:
2020-02-19 11:12:13 +01:00
parent da5583c797
commit 9b46dab404
4 changed files with 99 additions and 11 deletions

View File

@ -0,0 +1,39 @@
<?php
namespace App\DataFixtures;
use App\Entity\Project;
use App\Entity\User;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
class ProjectFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager)
{
$dev1 = $manager
->getRepository(User::class)
->findOneByUsername('dev1')
;
$project1 = new Project();
$project1->setName("Test");
$project1->addUser($dev1);
$manager->persist($project1);
$manager->flush();
}
public function getDependencies()
{
return [
UserFixtures::class,
];
}
}