mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Moved custom validators from annotations to attributes
This commit is contained in:
parent
e5a14557a2
commit
930adaf439
27 changed files with 50 additions and 148 deletions
|
@ -34,11 +34,8 @@ use Symfony\Component\Validator\ConstraintValidator;
|
|||
|
||||
class NoLockoutValidator extends ConstraintValidator
|
||||
{
|
||||
protected array $perm_structure;
|
||||
|
||||
public function __construct(protected PermissionManager $resolver, protected Security $security, protected EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,6 +68,8 @@ class NoLockoutValidator extends ConstraintValidator
|
|||
) ?? false)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
} else {
|
||||
throw new \LogicException('The NoLockout constraint can only be used on User or Group objects.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue