From 4e34485d8d26d2c997ae1934387c023c78fe4b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 29 Dec 2015 17:23:36 +0100 Subject: [PATCH] order results in person search by firstname and lastname --- Search/PersonSearch.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Search/PersonSearch.php b/Search/PersonSearch.php index 57b6b05f3..eceabd4ab 100644 --- a/Search/PersonSearch.php +++ b/Search/PersonSearch.php @@ -122,6 +122,11 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface ->setMaxResults($limit) ->setFirstResult($start); + //order by firstname, lastname + + $qb->orderBy('p.firstName') + ->addOrderBy('p.lastName'); + return $qb->getQuery()->getResult(); } @@ -147,7 +152,7 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface //get from cache $cacheKey = md5(serialize($terms)); if (array_key_exists($cacheKey, $this->_cacheQuery)) { - return $this->_cacheQuery[$cacheKey]; + return clone $this->_cacheQuery[$cacheKey]; } $qb = $this->em->createQueryBuilder(); @@ -220,10 +225,10 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface ->in('p.center', ':centers')) ->setParameter('centers', $reachableCenters) ; - + $this->_cacheQuery[$cacheKey] = $qb; - return $qb; + return clone $qb; } } \ No newline at end of file