rdv: fix adding thirdparty when creating a rdv

This commit is contained in:
nobohan 2021-07-19 11:30:06 +02:00
parent 450025c145
commit b894596304
2 changed files with 14 additions and 10 deletions

View File

@ -2,10 +2,10 @@
namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation\Groups;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
@ -15,6 +15,7 @@ use Chill\CalendarBundle\Entity\CancelReason;
use Chill\CalendarBundle\Entity\CalendarRange;
use Chill\CalendarBundle\Entity\Invite;
use Chill\ActivityBundle\Entity\Activity;
use Chill\CalendarBundle\Repository\CalendarRepository;
/**
* @ORM\Table(name="chill_calendar.calendar")
@ -36,6 +37,7 @@ class Calendar
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
* @Groups({"read"})
*/
private AccompanyingPeriod $accompanyingPeriod;
@ -50,6 +52,7 @@ class Calendar
* targetEntity="Chill\PersonBundle\Entity\Person",
* cascade={"persist", "remove", "merge", "detach"})
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
* @Groups({"read"})
*/
private Collection $persons;
@ -68,6 +71,7 @@ class Calendar
* targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty",
* cascade={"persist", "remove", "merge", "detach"})
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
* @Groups({"read"})
*/
private Collection $professionals;
@ -77,6 +81,7 @@ class Calendar
* targetEntity="Invite",
* cascade={"persist", "remove", "merge", "detach"})
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
* @Groups({"read"})
*/
private Collection $invites;

View File

@ -17,19 +17,18 @@ const removeIdFromValue = (string, id) => {
return str;
};
// const activity = {
// accompanyingPeriod: window.accompanyingPeriod,
// persons: [],
// thirdParties: [],
// users: []
// }; // TODO: get this object from window.activity ?
console.log(window.entity)
/*
* Assign missing keys for the ConcernedGroups component
*/
const mapEntity = (entity) => {
Object.assign(entity, {thirdParties: entity.professionals, users: entity.invites});
return entity;
};
const store = createStore({
strict: debug,
state: {
activity: window.entity,
activity: mapEntity(window.entity),
},
mutations: {