From 4eb49ff3639a8793c52ac2941a98f985506ef9a5 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sat, 4 Jan 2020 18:09:38 +0100 Subject: [PATCH] Persist catalgou --- api/src/DataFixtures/AppFixtures.php | 9 ++------- api/src/Entity/Product.php | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/api/src/DataFixtures/AppFixtures.php b/api/src/DataFixtures/AppFixtures.php index 80a7c016..5f7af32d 100644 --- a/api/src/DataFixtures/AppFixtures.php +++ b/api/src/DataFixtures/AppFixtures.php @@ -61,29 +61,24 @@ public function load(ObjectManager $manager) $vng->setName('Vereniging Nederlandse Gemeenten'); $vng->setSourceOrganization('0000'); $manager->persist($vng); - $manager->flush(); - $manager->refresh($vng); $denbosch= new Catalogue(); $denbosch->setName('Gemeente \'s-Hertogenbosch'); $denbosch->setSourceOrganization('001709124'); $manager->persist($denbosch); - $manager->flush(); - $manager->refresh($denbosch); $eindhoven = new Catalogue(); $eindhoven->setName('Gemeente Eindhoven'); $eindhoven->setSourceOrganization('001902763'); $manager->persist($eindhoven); - $manager->flush(); - $manager->refresh($eindhoven); $utrecht = new Catalogue(); $utrecht->setName('Gemeente Utrecht'); $utrecht->setSourceOrganization('002220647'); $manager->persist($utrecht); + + $manager->flush(); - $manager->refresh($utrecht); // Dan wat productgroepen $id = Uuid::fromString('5a6a1219-1e2d-4dc5-aa03-82ffe1ff6249'); diff --git a/api/src/Entity/Product.php b/api/src/Entity/Product.php index 9cf3e62e..41c1eb80 100644 --- a/api/src/Entity/Product.php +++ b/api/src/Entity/Product.php @@ -231,7 +231,7 @@ class Product * @var Catalogue The Catalogue that this product belongs to * * @MaxDepth(1) - * @ORM\ManyToOne(targetEntity="App\Entity\Catalogue", inversedBy="products") + * @ORM\ManyToOne(targetEntity="App\Entity\Catalogue", inversedBy="products",cascade={"persist"}) * @ORM\JoinColumn(nullable=false) * @Assert\NotNull * @Groups({"read","write"})