Skip to content
Snippets Groups Projects
Commit 7c46f618 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

divers

parent b7ba6b8b
No related branches found
No related tags found
No related merge requests found
...@@ -104,6 +104,17 @@ class StatutService extends AbstractEntityService ...@@ -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 * Retourne une nouvelle entité, initialisée avec les bons paramètres
* *
...@@ -111,8 +122,10 @@ class StatutService extends AbstractEntityService ...@@ -111,8 +122,10 @@ class StatutService extends AbstractEntityService
public function newEntity(): Statut public function newEntity(): Statut
{ {
/** @var Statut $entity */ /** @var Statut $entity */
$entity = parent::newEntity(); $statut = parent::newEntity();
$statut->setOrdre($this->fetchMaxOrdre() + 1);
return $entity; return $statut;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment