person search: add birthdate and file number

This commit is contained in:
Julien Fastré 2021-11-12 11:42:17 +01:00
parent 03fb75edc8
commit c2cfa19e43

View File

@ -161,7 +161,8 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface,
'p.firstName', 'p.firstName',
$qb->expr()->literal(' '), $qb->expr()->literal(' '),
'p.lastName' 'p.lastName'
).'AS text' ).'AS text',
'p.birthdate'
); );
} else { } else {
$qb->select('p'); $qb->select('p');
@ -178,7 +179,15 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface,
->addOrderBy('p.lastName'); ->addOrderBy('p.lastName');
if ($options['simplify'] ?? false) { 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 { } else {
return $qb->getQuery()->getResult(); return $qb->getQuery()->getResult();
} }