Release 2.10 (#4549)
This commit is contained in:
@@ -9,64 +9,10 @@
|
||||
|
||||
namespace App\Repository\Query;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
/**
|
||||
* Can be used to pre-fill form types with: UserRepository::getQueryBuilderForFormType()
|
||||
*/
|
||||
final class UserFormTypeQuery extends BaseFormTypeQuery
|
||||
{
|
||||
use VisibilityTrait;
|
||||
|
||||
/**
|
||||
* @var User[]
|
||||
*/
|
||||
private array $includeUsers = [];
|
||||
/**
|
||||
* @var User[]
|
||||
*/
|
||||
private array $ignoredUsers = [];
|
||||
|
||||
/**
|
||||
* Sets a list of users which must be included in the result always.
|
||||
*
|
||||
* @param array<User> $users
|
||||
*/
|
||||
public function setUsersAlwaysIncluded(array $users): void
|
||||
{
|
||||
$this->includeUsers = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of users which should always be included in the result.
|
||||
*
|
||||
* @return User[]
|
||||
*/
|
||||
public function getUsersAlwaysIncluded(): array
|
||||
{
|
||||
return $this->includeUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given user will be excluded from the result set.
|
||||
*
|
||||
* @param User $user
|
||||
* @return $this
|
||||
*/
|
||||
public function addUserToIgnore(User $user): UserFormTypeQuery
|
||||
{
|
||||
$this->ignoredUsers[] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of users that should not be loaded.
|
||||
*
|
||||
* @return User[]
|
||||
*/
|
||||
public function getUsersToIgnore(): array
|
||||
{
|
||||
return $this->ignoredUsers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class UserQuery extends BaseQuery implements VisibilityInterface
|
||||
{
|
||||
use VisibilityTrait;
|
||||
|
||||
public const USER_ORDER_ALLOWED = ['alias', 'user', 'username', 'title', 'email'];
|
||||
public const USER_ORDER_ALLOWED = ['username', 'alias', 'title', 'email', 'systemAccount'];
|
||||
|
||||
private ?string $role = null;
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ class UserQuery extends BaseQuery implements VisibilityInterface
|
||||
public function __construct()
|
||||
{
|
||||
$this->setDefaults([
|
||||
'orderBy' => 'user',
|
||||
'orderBy' => 'username',
|
||||
'searchTeams' => [],
|
||||
'visibility' => VisibilityInterface::SHOW_VISIBLE,
|
||||
'systemAccount' => null,
|
||||
|
||||
Reference in New Issue
Block a user