mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Use imports instead of FQNs
This commit is contained in:
parent
f63b6d7207
commit
5629215ce4
179 changed files with 792 additions and 597 deletions
|
@ -22,12 +22,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Validator\Constraints;
|
||||
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Services\UserSystem\PermissionManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
||||
|
@ -35,7 +36,7 @@ class NoLockoutValidator extends ConstraintValidator
|
|||
{
|
||||
protected array $perm_structure;
|
||||
|
||||
public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager)
|
||||
public function __construct(protected PermissionManager $resolver, protected Security $security, protected EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ class NoLockoutValidator extends ConstraintValidator
|
|||
if ($perm_holder instanceof User || $perm_holder instanceof Group) {
|
||||
$user = $this->security->getUser();
|
||||
|
||||
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
|
||||
if (!$user instanceof UserInterface) {
|
||||
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class ValidPartLotValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
//We can only validate the values if we know the storelocation
|
||||
if ($value->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
|
||||
if ($value->getStorageLocation() instanceof Storelocation) {
|
||||
$repo = $this->em->getRepository(Storelocation::class);
|
||||
//We can only determine associated parts, if the part have an ID
|
||||
//When the storage location is new (no ID), we can just assume there are no other parts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue