Autocomplete search bug fix.
This commit is contained in:
parent
4c3191aa86
commit
23042cf2b1
|
@ -32,10 +32,11 @@ class UserRepository extends EntityRepository
|
||||||
* Case insensitive user LIKE %login% search
|
* Case insensitive user LIKE %login% search
|
||||||
*
|
*
|
||||||
* @param string $login
|
* @param string $login
|
||||||
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* @return User[]
|
* @return User[]
|
||||||
*/
|
*/
|
||||||
public function findUsersLikeLogin($login)
|
public function findUsersLikeLogin($login, $limit = 10)
|
||||||
{
|
{
|
||||||
if (empty($login)) {
|
if (empty($login)) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -44,10 +45,10 @@ class UserRepository extends EntityRepository
|
||||||
$qb = $this->createQueryBuilder('u');
|
$qb = $this->createQueryBuilder('u');
|
||||||
|
|
||||||
return $qb
|
return $qb
|
||||||
->where('u.login LIKE :login')
|
->where('LOWER(u.login) LIKE LOWER(:login)')
|
||||||
->orderBy('u.login', 'ASC')
|
->orderBy('u.login', 'ASC')
|
||||||
->setMaxResults(10)
|
->setMaxResults($limit)
|
||||||
->setParameter('login', '%'.strtolower($login).'%')
|
->setParameter('login', '%'.$login.'%')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult()
|
->getResult()
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in a new issue