mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,27 +1,33 @@
|
||||
<?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\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
|
||||
class TimelinePersonController extends AbstractController
|
||||
{
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
protected TimelineBuilder $timelineBuilder;
|
||||
|
||||
protected PaginatorFactory $paginatorFactory;
|
||||
|
||||
protected TimelineBuilder $timelineBuilder;
|
||||
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
TimelineBuilder $timelineBuilder,
|
||||
@@ -35,37 +41,38 @@ class TimelinePersonController extends AbstractController
|
||||
public function personAction(Request $request, $person_id)
|
||||
{
|
||||
$person = $this->getDoctrine()
|
||||
->getRepository(Person::class)
|
||||
->find($person_id);
|
||||
->getRepository(Person::class)
|
||||
->find($person_id);
|
||||
|
||||
if ($person === NULL) {
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
$nbItems = $this->timelineBuilder->countItems('person',
|
||||
[ 'person' => $person ]
|
||||
);
|
||||
$nbItems = $this->timelineBuilder->countItems(
|
||||
'person',
|
||||
['person' => $person]
|
||||
);
|
||||
|
||||
$paginator = $this->paginatorFactory->create($nbItems);
|
||||
|
||||
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
||||
$event = new PrivacyEvent($person, ['action' => 'timeline']);
|
||||
$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',
|
||||
[
|
||||
'timeline' => $this->timelineBuilder->getTimelineHTML(
|
||||
'person',
|
||||
array('person' => $person),
|
||||
['person' => $person],
|
||||
$paginator->getCurrentPage()->getFirstItemNumber(),
|
||||
$paginator->getItemsPerPage()
|
||||
),
|
||||
),
|
||||
'person' => $person,
|
||||
'nb_items' => $nbItems,
|
||||
'paginator' => $paginator
|
||||
)
|
||||
'paginator' => $paginator,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user