fix errors on tests in person bundle

This commit is contained in:
2021-05-26 23:25:36 +02:00
parent b88765c344
commit aa473b5f70
3 changed files with 24 additions and 31 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');