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>
81 lines
2.1 KiB
PHP
81 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\DataFixtures;
|
|
|
|
use App\Entity\Employee;
|
|
use App\Entity\EmployeeLeaveBalance;
|
|
use App\Enum\LeaveRuleCode;
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
|
|
final class EmployeeLeaveBalanceFixtures extends Fixture implements DependentFixtureInterface
|
|
{
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$this->createOpeningBalance(
|
|
$manager,
|
|
$this->getReference(FixtureReferences::EMPLOYEE_STANDARD, Employee::class),
|
|
LeaveRuleCode::CDI_CDD_NON_FORFAIT,
|
|
2026,
|
|
0.0,
|
|
0.0
|
|
);
|
|
|
|
$this->createOpeningBalance(
|
|
$manager,
|
|
$this->getReference(FixtureReferences::EMPLOYEE_4H, Employee::class),
|
|
LeaveRuleCode::CDI_CDD_NON_FORFAIT,
|
|
2026,
|
|
0.0,
|
|
0.0
|
|
);
|
|
|
|
$this->createOpeningBalance(
|
|
$manager,
|
|
$this->getReference(FixtureReferences::EMPLOYEE_FORFAIT, Employee::class),
|
|
LeaveRuleCode::FORFAIT_218,
|
|
2026,
|
|
0.0,
|
|
0.0
|
|
);
|
|
|
|
$manager->flush();
|
|
}
|
|
|
|
public function getDependencies(): array
|
|
{
|
|
return [
|
|
EmployeeFixtures::class,
|
|
];
|
|
}
|
|
|
|
private function createOpeningBalance(
|
|
ObjectManager $manager,
|
|
Employee $employee,
|
|
LeaveRuleCode $ruleCode,
|
|
int $year,
|
|
float $openingDays,
|
|
float $openingSaturdays
|
|
): void {
|
|
$balance = new EmployeeLeaveBalance()
|
|
->setEmployee($employee)
|
|
->setRuleCode($ruleCode)
|
|
->setYear($year)
|
|
->setOpeningDays($openingDays)
|
|
->setOpeningSaturdays($openingSaturdays)
|
|
->setAccruedDays(0.0)
|
|
->setAccruedSaturdays(0.0)
|
|
->setTakenDays(0.0)
|
|
->setTakenSaturdays(0.0)
|
|
->setClosingDays($openingDays)
|
|
->setClosingSaturdays($openingSaturdays)
|
|
->setIsLocked(false)
|
|
;
|
|
|
|
$manager->persist($balance);
|
|
}
|
|
}
|