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>
118 lines
2.8 KiB
PHP
118 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\EmployeeRttBalanceRepository;
|
|
use DateTimeImmutable;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: EmployeeRttBalanceRepository::class)]
|
|
#[ORM\Table(name: 'employee_rtt_balances', options: ['comment' => 'Soldes RTT par employe et exercice (report N-1).'])]
|
|
#[ORM\UniqueConstraint(name: 'uniq_employee_rtt_balance', columns: ['employee_id', 'year'])]
|
|
#[ORM\Index(columns: ['employee_id', 'year'], name: 'idx_rtt_balance_employee_year')]
|
|
class EmployeeRttBalance
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column(type: 'integer')]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Employee::class)]
|
|
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
|
|
private ?Employee $employee = null;
|
|
|
|
#[ORM\Column(type: 'integer', options: ['comment' => 'Annee d exercice (year = annee de fin, ex: 2026 = 01/06/2025 -> 31/05/2026).'])]
|
|
private int $year = 0;
|
|
|
|
#[ORM\Column(type: 'integer', options: ['comment' => 'Report N-1 en minutes (solde d ouverture).'])]
|
|
private int $openingMinutes = 0;
|
|
|
|
#[ORM\Column(type: 'boolean', options: ['default' => false, 'comment' => 'Indique si le solde est fige (verrouille RH).'])]
|
|
private bool $isLocked = false;
|
|
|
|
#[ORM\Column(type: 'datetime_immutable')]
|
|
private DateTimeImmutable $createdAt;
|
|
|
|
#[ORM\Column(type: 'datetime_immutable')]
|
|
private DateTimeImmutable $updatedAt;
|
|
|
|
public function __construct()
|
|
{
|
|
$now = new DateTimeImmutable();
|
|
$this->createdAt = $now;
|
|
$this->updatedAt = $now;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getEmployee(): ?Employee
|
|
{
|
|
return $this->employee;
|
|
}
|
|
|
|
public function setEmployee(Employee $employee): self
|
|
{
|
|
$this->employee = $employee;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getYear(): int
|
|
{
|
|
return $this->year;
|
|
}
|
|
|
|
public function setYear(int $year): self
|
|
{
|
|
$this->year = $year;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getOpeningMinutes(): int
|
|
{
|
|
return $this->openingMinutes;
|
|
}
|
|
|
|
public function setOpeningMinutes(int $openingMinutes): self
|
|
{
|
|
$this->openingMinutes = $openingMinutes;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isLocked(): bool
|
|
{
|
|
return $this->isLocked;
|
|
}
|
|
|
|
public function setIsLocked(bool $isLocked): self
|
|
{
|
|
$this->isLocked = $isLocked;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function getUpdatedAt(): DateTimeImmutable
|
|
{
|
|
return $this->updatedAt;
|
|
}
|
|
|
|
public function touch(): self
|
|
{
|
|
$this->updatedAt = new DateTimeImmutable();
|
|
|
|
return $this;
|
|
}
|
|
}
|