Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #6 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
39 lines
881 B
PHP
39 lines
881 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Repository;
|
|
|
|
use App\Entity\User;
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
/**
|
|
* @extends ServiceEntityRepository<User>
|
|
*/
|
|
final class UserRepository extends ServiceEntityRepository
|
|
{
|
|
public function __construct(ManagerRegistry $registry)
|
|
{
|
|
parent::__construct($registry, User::class);
|
|
}
|
|
|
|
/**
|
|
* @return list<User>
|
|
*/
|
|
public function findAllAdmins(): array
|
|
{
|
|
/** @var list<User> $users */
|
|
$users = $this->createQueryBuilder('u')
|
|
->orderBy('u.id', 'ASC')
|
|
->getQuery()
|
|
->getResult()
|
|
;
|
|
|
|
return array_values(array_filter(
|
|
$users,
|
|
static fn (User $user): bool => in_array('ROLE_ADMIN', $user->getRoles(), true)
|
|
));
|
|
}
|
|
}
|