mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
make timeline & paginator service private
This commit is contained in:
parent
5245d9971e
commit
d53e6b57a4
@ -24,6 +24,9 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -38,14 +41,31 @@ class TimelinePersonController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var TimelineBuilder
|
||||||
|
*/
|
||||||
|
protected $timelineBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var PaginatorFactory
|
||||||
|
*/
|
||||||
|
protected $paginatorFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimelinePersonController constructor.
|
* TimelinePersonController constructor.
|
||||||
*
|
*
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
* @param EventDispatcherInterface $eventDispatcher
|
||||||
*/
|
*/
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
public function __construct(
|
||||||
{
|
EventDispatcherInterface $eventDispatcher,
|
||||||
|
TimelineBuilder $timelineBuilder,
|
||||||
|
PaginatorFactory $paginatorFactory
|
||||||
|
) {
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
$this->timelineBuilder = $timelineBuilder;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,24 +79,20 @@ class TimelinePersonController extends Controller
|
|||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
/* @var $timelineBuilder \Chill\MainBundle\Timeline\TimelineBuilder */
|
$nbItems = $this->timelineBuilder->countItems('person',
|
||||||
$timelineBuilder = $this->get('chill.main.timeline_builder');
|
|
||||||
$paginatorFactory = $this->get('chill_main.paginator_factory');
|
|
||||||
|
|
||||||
$nbItems = $timelineBuilder->countItems('person',
|
|
||||||
[ 'person' => $person ]
|
[ 'person' => $person ]
|
||||||
);
|
);
|
||||||
|
|
||||||
$paginator = $paginatorFactory->create($nbItems);
|
$paginator = $this->paginatorFactory->create($nbItems);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
||||||
(
|
(
|
||||||
'timeline' => $timelineBuilder->getTimelineHTML(
|
'timeline' => $this->timelineBuilder->getTimelineHTML(
|
||||||
'person',
|
'person',
|
||||||
array('person' => $person),
|
array('person' => $person),
|
||||||
$paginator->getCurrentPage()->getFirstItemNumber(),
|
$paginator->getCurrentPage()->getFirstItemNumber(),
|
||||||
|
@ -11,6 +11,8 @@ services:
|
|||||||
Chill\PersonBundle\Controller\TimelinePersonController:
|
Chill\PersonBundle\Controller\TimelinePersonController:
|
||||||
arguments:
|
arguments:
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
$timelineBuilder: '@chill_main.timeline_builder'
|
||||||
|
$paginatorFactory: '@chill_main.paginator_factory'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
Chill\PersonBundle\Controller\AccompanyingPeriodController:
|
Chill\PersonBundle\Controller\AccompanyingPeriodController:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user