Commit 57ca76ab authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout de la methode getCalendrierByTypeCode dans le trait

parent e6704c1d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,5 +10,5 @@ interface HasCalendriersInterface {
    public function addCalendrier(Calendrier $calendrier): void;
    public function removeCalendrier(Calendrier $calendrier): void;
    public function hasCalendrier(?Calendrier $calendrier): bool;

    public function getCalendrierByTypeCode(string $code): ?Calendrier;
}
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -29,4 +29,13 @@ trait HasCalendriersTrait {
    {
        return $this->calendriers->contains($calendrier);
    }

    public function getCalendrierByTypeCode(string $code): ?Calendrier
    {
        /** @var Calendrier $calendrier */
        foreach ($this->calendriers as $calendrier) {
            if ($calendrier->estNonHistorise() && $calendrier->getCalendrierType()->getCode() === $code) return $calendrier;
        }
        return null;
    }
}
 No newline at end of file