Merge branch 'fix-person-tests' into features/household

This commit is contained in:
2021-05-31 21:40:24 +02:00
51 changed files with 1410 additions and 589 deletions

View File

@@ -390,13 +390,13 @@ class AccompanyingPeriodController extends AbstractController
/** @var Person $person */
$person = $this->_getPerson($person_id);
$criteria = Criteria::create();
$criteria->where($criteria->expr()->eq('id', $period_id));
/* @var $period AccompanyingPeriod */
$period = $person->getAccompanyingPeriods()
->matching($criteria)
->first();
$period = \array_filter(
$person->getAccompanyingPeriods(),
function (AccompanyingPeriod $p) use ($period_id) {
return $p->getId() === ($period_id);
}
)[0] ?? NULL;
if ($period === NULL) {
throw $this->createNotFoundException('period not found');

View File

@@ -27,32 +27,17 @@ use Symfony\Component\HttpFoundation\Request;
use Chill\MainBundle\Timeline\TimelineBuilder;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Role\Role;
/**
* Class TimelinePersonController
*
* @package Chill\PersonBundle\Controller
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class TimelinePersonController extends AbstractController
{
/**
* @var EventDispatcherInterface
*/
protected $eventDispatcher;
protected EventDispatcherInterface $eventDispatcher;
/**
*
* @var TimelineBuilder
*/
protected $timelineBuilder;
protected TimelineBuilder $timelineBuilder;
/**
*
* @var PaginatorFactory
*/
protected $paginatorFactory;
protected PaginatorFactory $paginatorFactory;
/**
* TimelinePersonController constructor.
@@ -62,11 +47,13 @@ class TimelinePersonController extends AbstractController
public function __construct(
EventDispatcherInterface $eventDispatcher,
TimelineBuilder $timelineBuilder,
PaginatorFactory $paginatorFactory
PaginatorFactory $paginatorFactory,
AuthorizationHelper $authorizationHelper
) {
$this->eventDispatcher = $eventDispatcher;
$this->timelineBuilder = $timelineBuilder;
$this->paginatorFactory = $paginatorFactory;
$this->authorizationHelper = $authorizationHelper;
}