mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
paginator added + phpcsfixes
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -56,24 +64,22 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
// $total = $this->accompanyingPeriodACLAwareRepository->countByUserConfirmed(
|
||||
// $form['jobs']->getData(),
|
||||
// $form['services']->getData(),
|
||||
// $form['locations']->getData(),
|
||||
// );
|
||||
// $paginator = $this->paginatorFactory->create($total);
|
||||
$total = $this->accompanyingPeriodACLAwareRepository->countByUserConfirmed(
|
||||
$form['user']->getData()
|
||||
);
|
||||
$paginator = $this->paginatorFactory->create($total);
|
||||
$periods = $this->accompanyingPeriodACLAwareRepository
|
||||
->findByUserConfirmed(
|
||||
$form['user']->getData(),
|
||||
1,
|
||||
1
|
||||
$paginator->getItemsPerPage(),
|
||||
$paginator->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
return new Response(
|
||||
$this->engine->render('@ChillPerson/AccompanyingPeriod/reassign_list.html.twig', [
|
||||
// 'paginator' => $paginator,
|
||||
'paginator' => $paginator,
|
||||
'periods' => $periods,
|
||||
'form' => $form->createView()
|
||||
'form' => $form->createView(),
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -81,7 +87,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
private function buildFilterForm(): FormInterface
|
||||
{
|
||||
$builder = $this->formFactory->createBuilder(FormType::class, [
|
||||
'method' => 'get', 'csrf_protection' => false]);
|
||||
'method' => 'get', 'csrf_protection' => false, ]);
|
||||
|
||||
$builder
|
||||
->add('user', EntityType::class, [
|
||||
@@ -94,7 +100,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
return $qb;
|
||||
},
|
||||
'choice_label' => function (User $u) {
|
||||
'choice_label' => static function (User $u) {
|
||||
return $u->getUsername();
|
||||
},
|
||||
'multiple' => false,
|
||||
@@ -104,5 +110,4 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
return $builder->getForm();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user