mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
fix creation of new household during move
This commit is contained in:
parent
057bdf6a6a
commit
6fed008ff2
@ -54,6 +54,11 @@ class HouseholdMemberController extends ApiController
|
|||||||
//
|
//
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
// if new household, persist it
|
||||||
|
if (FALSE === $em->contains($editor->getHousehold())) {
|
||||||
|
$em->persist($editor->getHousehold());
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($editor->getPersistable() as $el) {
|
foreach ($editor->getPersistable() as $el) {
|
||||||
$em->persist($el);
|
$em->persist($el);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ class MembersEditor
|
|||||||
->setPerson($person)
|
->setPerson($person)
|
||||||
->setPosition($position)
|
->setPosition($position)
|
||||||
->setHolder($holder)
|
->setHolder($holder)
|
||||||
->setHousehold($this->household)
|
|
||||||
->setComment($comment)
|
->setComment($comment)
|
||||||
;
|
;
|
||||||
|
$this->household->addMember($membership);
|
||||||
|
|
||||||
if ($position->getShareHousehold()) {
|
if ($position->getShareHousehold()) {
|
||||||
foreach ($person->getHouseholdParticipations() as $participation) {
|
foreach ($person->getHouseholdParticipations() as $participation) {
|
||||||
|
@ -34,7 +34,7 @@ class MembersEditorNormalizer implements DenormalizerInterface, DenormalizerAwar
|
|||||||
|
|
||||||
$editor = $this->factory->createEditor($household);
|
$editor = $this->factory->createEditor($household);
|
||||||
|
|
||||||
if (NULL == $data['concerned'] ?? []
|
if (NULL == $data['concerned'] ?? NULL
|
||||||
&& FALSE === ·\is_array('concerned')) {
|
&& FALSE === ·\is_array('concerned')) {
|
||||||
throw new Exception\UnexpectedValueException("The schema does not have any key 'concerned'");
|
throw new Exception\UnexpectedValueException("The schema does not have any key 'concerned'");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user