fix methods for accompanying period repository acl aware

* add method to interface
* delegate ACL to another method
This commit is contained in:
2022-03-21 14:54:01 +01:00
parent 293efc03b4
commit ac9e55e2fc
5 changed files with 39 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Entity\UserRender;
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepository;
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\FormType;
@@ -30,7 +31,7 @@ use Symfony\Component\Templating\EngineInterface;
class ReassignAccompanyingPeriodController extends AbstractController
{
private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository;
private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository;
private EngineInterface $engine;
@@ -44,7 +45,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
private UserRepository $userRepository;
public function __construct(AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, UserRepository $userRepository, EngineInterface $engine, FormFactoryInterface $formFactory, PaginatorFactory $paginatorFactory, Security $security, UserRender $userRender)
public function __construct(AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, UserRepository $userRepository, EngineInterface $engine, FormFactoryInterface $formFactory, PaginatorFactory $paginatorFactory, Security $security, UserRender $userRender)
{
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
$this->engine = $engine;
@@ -68,13 +69,14 @@ class ReassignAccompanyingPeriodController extends AbstractController
$form->handleRequest($request);
$total = $this->accompanyingPeriodACLAwareRepository->countByUserConfirmed(
$total = $this->accompanyingPeriodACLAwareRepository->countByUserOpenedAccompanyingPeriod(
$form['user']->getData()
);
$paginator = $this->paginatorFactory->create($total);
$periods = $this->accompanyingPeriodACLAwareRepository
->findByUserConfirmed(
->findByUserOpenedAccompanyingPeriod(
$form['user']->getData(),
['openingDate' => 'ASC'],
$paginator->getItemsPerPage(),
$paginator->getCurrentPageFirstItemNumber()
);