Commit 7c46f618 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

divers

parent b7ba6b8b
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment