further attempts to do POST of thirdparty contact, passing parent id causes problems + civility and profession fk's are not saved on POST

This commit is contained in:
2022-01-17 12:00:22 +01:00
parent 47615e2e5d
commit a31b74e0e5
3 changed files with 18 additions and 8 deletions

View File

@@ -126,7 +126,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var Civility
* @ORM\ManyToOne(targetEntity=Civility::class)
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
* @Groups({"docgen:read", "read", "write", "docgen:read:3party:parent"})
* @Groups({"docgen:read", "docgen:read:3party:parent"})
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
*/
private ?Civility $civility = null;
@@ -166,7 +166,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
* @Groups({"read", "docgen:read", "docgen:read:3party:parent"})
*/
private ?int $id = null;
@@ -199,7 +199,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
*
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
* @Groups({"read", "write", "docgen:read"})
* @Groups({"docgen:read"})
* @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"})
*/
private ?ThirdParty $parent = null;

View File

@@ -154,8 +154,7 @@ export default {
return {
//context: {}, <--
thirdparty: {
type: 'thirdparty',
parent: this.parent.id
type: 'thirdparty'
},
professions: [],
civilities: [],
@@ -213,7 +212,7 @@ export default {
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
this.thirdparty = thirdparty;
this.thirdparty.kind = thirdparty.kind;
//console.log('get thirdparty', thirdparty);
console.log('get thirdparty', thirdparty);
if (this.action !== 'show') {
if (thirdparty.address !== null) {
// bof! we force getInitialAddress because addressId not available when mounted
@@ -262,6 +261,9 @@ export default {
this.loadData();
}
if (this.action === 'addContact') {
this.$data.thirdparty.kind = 'child'
// this.$data.thirdparty.parent = this.parent.id
this.$data.thirdparty.address = null
this.loadProfessions();
this.loadCivilities();
}