mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
DX: fix phpstan errors
This commit is contained in:
parent
584ac05b53
commit
264a6ef43e
@ -80,7 +80,6 @@ class Country
|
||||
/**
|
||||
* Get name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ interface ChillEntityRenderInterface
|
||||
/**
|
||||
* Return true if the class support this object for the given options.
|
||||
*
|
||||
* @param type $entity
|
||||
* @param object $entity
|
||||
*/
|
||||
public function supports($entity, array $options): bool;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ final class EvaluationRepository implements EvaluationRepositoryInterface
|
||||
$this->repository = $entityManager->getRepository(Evaluation::class);
|
||||
}
|
||||
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Evaluation
|
||||
public function find($id): ?Evaluation
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
interface EvaluationRepositoryInterface extends ObjectRepository
|
||||
{
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Evaluation;
|
||||
public function find($id): ?Evaluation;
|
||||
|
||||
/**
|
||||
* @return array<int, Evaluation>
|
||||
|
@ -38,9 +38,9 @@ final class GoalRepository implements ObjectRepository
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Goal
|
||||
public function find($id): ?Goal
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,9 +48,9 @@ final class ResultRepository implements ObjectRepository
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Result
|
||||
public function find($id): ?Result
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,9 +32,9 @@ final class SocialActionRepository implements ObjectRepository
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialAction
|
||||
public function find($id): ?SocialAction
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,9 +27,9 @@ final class SocialIssueRepository implements ObjectRepository
|
||||
$this->repository = $entityManager->getRepository(SocialIssue::class);
|
||||
}
|
||||
|
||||
public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialIssue
|
||||
public function find($id): ?SocialIssue
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,9 +33,8 @@ final class ThirdPartyRepository implements ObjectRepository
|
||||
/**
|
||||
* count amongst parties associated to $centers, with $terms parameters.
|
||||
*
|
||||
* @param type $terms
|
||||
*/
|
||||
public function countByMemberOfCenters(array $centers, $terms = []): int
|
||||
public function countByMemberOfCenters(array $centers, array $terms = []): int
|
||||
{
|
||||
$qb = $this->buildQuery($centers, $terms);
|
||||
$qb->select('COUNT(tp)');
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
services:
|
||||
Chill\ThirdPartyBundle\Search\ThirdPartySearch:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
|
||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||
$paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory'
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: 'chill.search', alias: '3party' }
|
||||
|
||||
|
@ -76,7 +76,7 @@ final class ChillDocumentManager implements DocumentManagerInterface
|
||||
$document->setFilename($data['name']);
|
||||
|
||||
$this->entityManager->persist($document);
|
||||
$this->entityManager->flush($document);
|
||||
$this->entityManager->flush();
|
||||
|
||||
// TODO : Ask proper mapping.
|
||||
// Available: basename, name, extension, content, size
|
||||
|
Loading…
x
Reference in New Issue
Block a user