mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 13:33:48 +00:00
DX: fix phpstan errors
This commit is contained in:
@@ -15,6 +15,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Search\SearchInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
@@ -47,16 +48,20 @@ class ThirdPartySearch implements SearchInterface
|
||||
*/
|
||||
protected $tokenStorage;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory
|
||||
PaginatorFactory $paginatorFactory,
|
||||
ThirdPartyRepository $thirdPartyRepository
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
}
|
||||
|
||||
public function getOrder(): int
|
||||
@@ -74,7 +79,7 @@ class ThirdPartySearch implements SearchInterface
|
||||
$centers = $this->authorizationHelper
|
||||
->getReachableCenters(
|
||||
$this->tokenStorage->getToken()->getUser(),
|
||||
new Role(ThirdPartyVoter::SHOW)
|
||||
ThirdPartyVoter::SHOW
|
||||
);
|
||||
$total = $this->count($centers, $terms);
|
||||
$paginator = $this->paginatorFactory->create($total);
|
||||
@@ -84,7 +89,7 @@ class ThirdPartySearch implements SearchInterface
|
||||
|
||||
if ('json' === $format) {
|
||||
return [
|
||||
'results' => $this->em->getRepository(ThirdParty::class)
|
||||
'results' => $this->thirdPartyRepository
|
||||
->findByMemberOfCenters(
|
||||
$centers,
|
||||
$start,
|
||||
@@ -104,7 +109,7 @@ class ThirdPartySearch implements SearchInterface
|
||||
|
||||
protected function count($centers, $terms): int
|
||||
{
|
||||
return $this->em->getRepository(ThirdParty::class)
|
||||
return $this->thirdPartyRepository
|
||||
->countByMemberOfCenters($centers, $terms);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user