diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index 6d562ec95..994759d0a 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -161,7 +161,8 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface, 'p.firstName', $qb->expr()->literal(' '), 'p.lastName' - ).'AS text' + ).'AS text', + 'p.birthdate' ); } else { $qb->select('p'); @@ -178,7 +179,15 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface, ->addOrderBy('p.lastName'); if ($options['simplify'] ?? false) { - return $qb->getQuery()->getResult(Query::HYDRATE_ARRAY); + return \array_map( + function($row) { + $row['text'] .= ' ('.($row['birthdate'] instanceof \DateTimeInterface ? $row['birthdate']->format('d/m/Y').' - ' : '').'dossier n°'.$row['id'].')'; + + return $row; + } + , + $qb->getQuery()->getResult(Query::HYDRATE_ARRAY) + ); } else { return $qb->getQuery()->getResult(); }