ajout compteurs

This commit is contained in:
2022-01-27 17:28:59 +01:00
parent 39a7cecd24
commit ce912e4405
5 changed files with 74 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Serializer\Model\Collection;
use Chill\MainBundle\Serializer\Model\Counter;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationRepository;
@@ -95,6 +96,16 @@ class AccompanyingPeriodWorkEvaluationApiController
{
$total = $this->accompanyingPeriodWorkEvaluationRepository
->countNearMaxDateByUser($this->security->getUser());
if ($request->query->getBoolean('countOnly', false)) {
return new JsonResponse(
$this->serializer->serialize(new Counter($total), 'json', ['groups' => 'read']),
JsonResponse::HTTP_OK,
[],
true
);
}
$paginator = $this->paginatorFactory->create($total);
$works = $this->accompanyingPeriodWorkEvaluationRepository
->findNearMaxDateByUser(