feat: selectable feedback author for administrative users
addresses #869at5nbp
This commit is contained in:
@@ -61,6 +61,35 @@ class UserRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active users holding at least one of the given roles.
|
||||
*
|
||||
* @param string[] $roles
|
||||
*
|
||||
* @return User[]
|
||||
*/
|
||||
public function getUsersByRoles(array $roles): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('user');
|
||||
|
||||
$roleMatches = $qb->expr()->orX();
|
||||
|
||||
foreach ($roles as $index => $role) {
|
||||
$roleMatches->add('JSON_CONTAINS(user.roles, :role_'.$index.') = 1');
|
||||
$qb->setParameter('role_'.$index, json_encode($role));
|
||||
}
|
||||
|
||||
return $qb
|
||||
->andWhere($roleMatches)
|
||||
->andWhere($qb->expr()->isNull('user.deletedAt'))
|
||||
->andWhere($qb->expr()->isNull('user.disabledAt'))
|
||||
->orderBy('user.lastName', 'ASC')
|
||||
->addOrderBy('user.firstName', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[]|string $hotelCode
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user