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); } }