| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class UserRepository extends ServiceEntityRepository |
||
| 10 | { |
||
| 11 | public function __construct(ManagerRegistry $registry) |
||
| 12 | { |
||
| 13 | parent::__construct($registry, User::class); |
||
| 14 | } |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param $q |
||
| 18 | * @return mixed |
||
| 19 | */ |
||
| 20 | public function autocomplete($q): mixed |
||
| 21 | { |
||
| 22 | $query = $this->createQueryBuilder('u'); |
||
| 23 | |||
| 24 | $query |
||
| 25 | ->where('u.username LIKE :q') |
||
| 26 | ->setParameter('q', '%' . $q . '%') |
||
| 27 | //->andWhere('u.enabled = 1') |
||
| 28 | ->orderBy('u.username', 'ASC'); |
||
| 29 | |||
| 30 | return $query->getQuery()->getResult(); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param $object |
||
| 35 | * @return void |
||
| 36 | */ |
||
| 37 | public function save($object): void |
||
| 41 | } |
||
| 42 | |||
| 43 | |||
| 44 | public function flush(): void |
||
| 47 | } |
||
| 48 | } |
||
| 49 |