Commit 7c46f618 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

divers

parent b7ba6b8b
Loading
Loading
Loading
Loading
+15 −2
Changes for module/Intervenant/src/Service/StatutService.php: 15 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -104,6 +104,17 @@ class StatutService extends AbstractEntityService



    public function fetchMaxOrdre(): int
    {
        $sql = 'SELECT MAX(ORDRE) MAX_ORDRE FROM STATUT_INTERVENANT WHERE HISTO_DESTRUCTION IS NULL';

        $res = $this->getEntityManager()->getConnection()->fetchColumn($sql, [], 0);

        return (int)$res;
    }



    /**
     * Retourne une nouvelle entité, initialisée avec les bons paramètres
     *
@@ -111,8 +122,10 @@ class StatutService extends AbstractEntityService
    public function newEntity(): Statut
    {
        /** @var Statut $entity */
        $entity = parent::newEntity();
        $statut = parent::newEntity();

        $statut->setOrdre($this->fetchMaxOrdre() + 1);

        return $entity;
        return $statut;
    }
}
 No newline at end of file