Ajout des notification + page employé (#6)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
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>
This commit was merged in pull request #6.
This commit is contained in:
91
src/DataFixtures/EmployeeContractPeriodFixtures.php
Normal file
91
src/DataFixtures/EmployeeContractPeriodFixtures.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Entity\Contract;
|
||||
use App\Entity\Employee;
|
||||
use App\Entity\EmployeeContractPeriod;
|
||||
use App\Enum\ContractNature;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
final class EmployeeContractPeriodFixtures extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$this->createPeriod(
|
||||
$manager,
|
||||
$this->getReference(FixtureReferences::EMPLOYEE_STANDARD, Employee::class),
|
||||
$this->getReference(FixtureReferences::CONTRACT_35, Contract::class),
|
||||
'2025-01-01',
|
||||
null,
|
||||
ContractNature::CDI,
|
||||
false
|
||||
);
|
||||
|
||||
$this->createPeriod(
|
||||
$manager,
|
||||
$this->getReference(FixtureReferences::EMPLOYEE_4H, Employee::class),
|
||||
$this->getReference(FixtureReferences::CONTRACT_4H, Contract::class),
|
||||
'2026-01-01',
|
||||
'2026-12-31',
|
||||
ContractNature::CDD,
|
||||
false
|
||||
);
|
||||
|
||||
$this->createPeriod(
|
||||
$manager,
|
||||
$this->getReference(FixtureReferences::EMPLOYEE_FORFAIT, Employee::class),
|
||||
$this->getReference(FixtureReferences::CONTRACT_FORFAIT, Contract::class),
|
||||
'2024-01-01',
|
||||
null,
|
||||
ContractNature::CDI,
|
||||
false
|
||||
);
|
||||
|
||||
$this->createPeriod(
|
||||
$manager,
|
||||
$this->getReference(FixtureReferences::EMPLOYEE_INTERIM, Employee::class),
|
||||
$this->getReference(FixtureReferences::CONTRACT_INTERIM, Contract::class),
|
||||
'2026-02-01',
|
||||
'2026-06-30',
|
||||
ContractNature::INTERIM,
|
||||
false
|
||||
);
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return [
|
||||
EmployeeFixtures::class,
|
||||
ContractFixtures::class,
|
||||
];
|
||||
}
|
||||
|
||||
private function createPeriod(
|
||||
ObjectManager $manager,
|
||||
Employee $employee,
|
||||
Contract $contract,
|
||||
string $startDate,
|
||||
?string $endDate,
|
||||
ContractNature $nature,
|
||||
bool $paidLeaveSettled
|
||||
): void {
|
||||
$period = new EmployeeContractPeriod()
|
||||
->setEmployee($employee)
|
||||
->setContract($contract)
|
||||
->setStartDate(new DateTimeImmutable($startDate))
|
||||
->setEndDate(null === $endDate ? null : new DateTimeImmutable($endDate))
|
||||
->setContractNature($nature)
|
||||
->setPaidLeaveSettled($paidLeaveSettled)
|
||||
;
|
||||
|
||||
$manager->persist($period);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user