Untitled
unknown
php
13 days ago
993 B
3
Indexable
private function addPatientFullNameFilter(QueryBuilder $qb, ?string $fullName): void { if (null !== $fullName) { $qb->join('a.participants', 'p') ->leftJoin( $this->getEntityManager()->getClassMetadata(Patient::class)->getName(), 'pp', Join::WITH, 'p.id = pp.id' ) ->andWhere( $qb->expr()->like( 'unaccent(lower(' . $qb->expr()->concat('pp.firstname', $qb->expr()->literal(' '), 'pp.lastname') . '))', ':fullName' ) ) ->setParameter('fullName', '%' . mb_strtolower($this->removeAccents($fullName)) . '%'); } } private function removeAccents(string $string): string { $normalized = \Normalizer::normalize($string, \Normalizer::FORM_D); return preg_replace('/[\p{Mn}]/u', '', $normalized); }
Editor is loading...
Leave a Comment