diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue index f8d221674..24f69a9fe 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -74,7 +74,12 @@ export default { case 'thirdparty': let data = this.$refs.castThirdparty.$data.thirdparty; data.name = data.text; - data.address = { id: data.address.address_id } + if (data.address !== undefined) { + data.address = { id: data.address.address_id } + } else { + data.address = null; + } + return data; default: throw Error('Invalid type of entity') diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index f2dd0301e..b309c4542 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -65,6 +65,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(name="kind", type="string", length="20", options={"default":""}) + * @Groups({"write"}) */ private ?string $kind = ""; @@ -133,14 +134,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * @Groups({"read"}) */ - private ?ThirdParty $parent; + private ?ThirdParty $parent = null; /** * @var Civility * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) */ - private ?Civility $civility; + private ?Civility $civility = null; /** * [fr] Qualité @@ -148,7 +149,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) */ - private ?ThirdPartyProfession $profession; + private ?ThirdPartyProfession $profession = null; /** * @var string|null @@ -463,10 +464,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface } /** - * @param Address $address + * @param Address|null $address * @return $this */ - public function setAddress(Address $address) + public function setAddress(?Address $address = null) { $this->address = $address; diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 21b79a1c7..401cf1fa8 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -20,6 +20,20 @@