Adapt entity AccompanyingPeriodParticipation attributes and methods (dont break UI)

This commit is contained in:
2021-03-31 20:57:15 +02:00
parent a98056d31b
commit 01f24ecf1f
7 changed files with 203 additions and 58 deletions

View File

@@ -88,12 +88,12 @@ class AccompanyingPeriodController extends AbstractController
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
'You are not allowed to update this person');
$accompanyingPeriod = new AccompanyingPeriod(new \DateTime());
$accompanyingPeriod->setClosingDate(new \DateTime());
$person->addAccompanyingPeriod(
$accompanyingPeriod);
$accompanyingPeriod = new AccompanyingPeriod(new \DateTimeImmutable('now'));
$accompanyingPeriod->setClosingDate(new \DateTimeImmutable('now'));
$accompanyingPeriod->addPerson($person);
//or $person->addAccompanyingPeriod($accompanyingPeriod);
$form = $this->createForm(
AccompanyingPeriodType::class,
$accompanyingPeriod, [
@@ -153,8 +153,9 @@ class AccompanyingPeriodController extends AbstractController
}
/** @var Person $person */
$person = $em->getRepository(Person::class)->find($person_id);
$person = $this->_getPerson($person_id);
// CHECK
if (! $accompanyingPeriod->containsPerson($person)) {
throw new Exception("Accompanying period " . $period_id . " does not contain person " . $person_id);
}