Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #6 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\DataFixtures;
|
|
|
|
use App\Entity\Contract;
|
|
use App\Entity\Employee;
|
|
use App\Entity\Site;
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
|
|
final class EmployeeFixtures extends Fixture implements DependentFixtureInterface
|
|
{
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$site = $this->getReference(FixtureReferences::SITE_MAIN, Site::class);
|
|
|
|
$employeeStandard = new Employee()
|
|
->setFirstName('Alice')
|
|
->setLastName('Martin')
|
|
->setSite($site)
|
|
->setContract($this->getReference(FixtureReferences::CONTRACT_35, Contract::class))
|
|
->setDisplayOrder(1)
|
|
;
|
|
|
|
$employee4h = new Employee()
|
|
->setFirstName('Bruno')
|
|
->setLastName('Petit')
|
|
->setSite($site)
|
|
->setContract($this->getReference(FixtureReferences::CONTRACT_4H, Contract::class))
|
|
->setDisplayOrder(2)
|
|
;
|
|
|
|
$employeeForfait = new Employee()
|
|
->setFirstName('Chloe')
|
|
->setLastName('Durand')
|
|
->setSite($site)
|
|
->setContract($this->getReference(FixtureReferences::CONTRACT_FORFAIT, Contract::class))
|
|
->setDisplayOrder(3)
|
|
;
|
|
|
|
$employeeInterim = new Employee()
|
|
->setFirstName('David')
|
|
->setLastName('Leroy')
|
|
->setSite($site)
|
|
->setContract($this->getReference(FixtureReferences::CONTRACT_INTERIM, Contract::class))
|
|
->setDisplayOrder(4)
|
|
;
|
|
|
|
$manager->persist($employeeStandard);
|
|
$manager->persist($employee4h);
|
|
$manager->persist($employeeForfait);
|
|
$manager->persist($employeeInterim);
|
|
$manager->flush();
|
|
|
|
$this->addReference(FixtureReferences::EMPLOYEE_STANDARD, $employeeStandard);
|
|
$this->addReference(FixtureReferences::EMPLOYEE_4H, $employee4h);
|
|
$this->addReference(FixtureReferences::EMPLOYEE_FORFAIT, $employeeForfait);
|
|
$this->addReference(FixtureReferences::EMPLOYEE_INTERIM, $employeeInterim);
|
|
}
|
|
|
|
public function getDependencies(): array
|
|
{
|
|
return [
|
|
SiteFixtures::class,
|
|
ContractFixtures::class,
|
|
];
|
|
}
|
|
}
|