Find users with similar handles

This commit is contained in:
2025-02-24 14:55:53 +01:00
parent 40dc2f132a
commit d8aaaea353
+14
View File
@@ -66,6 +66,20 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
->getOneOrNullResult();
}
/**
* @return User[] Returns an array of User objects
*/
public function findLike(string $handle): array
{
return $this->createQueryBuilder('u')
->andWhere('u.handle LIKE :handle')
->setParameter('handle', \sprintf('%%%s%%', $handle))
->orderBy('u.id', 'ASC')
->getQuery()
->getResult()
;
}
// /**
// * @return User[] Returns an array of User objects
// */