diff --git a/src/AppBundle/Entity/Rebrickable/Inventory.php b/src/AppBundle/Entity/Rebrickable/Inventory.php index 36777df..3a8efe8 100644 --- a/src/AppBundle/Entity/Rebrickable/Inventory.php +++ b/src/AppBundle/Entity/Rebrickable/Inventory.php @@ -38,9 +38,18 @@ class Inventory */ protected $inventoryParts; + /** + * @var Collection + * + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_Set", mappedBy="inventory") + */ + protected $inventorySets; + + public function __construct() { $this->inventoryParts = new ArrayCollection(); + $this->inventorySets = new ArrayCollection(); } /** @@ -90,4 +99,20 @@ class Inventory { $this->inventoryParts = $inventoryParts; } + + /** + * @return Collection + */ + public function getInventorySets() + { + return $this->inventorySets; + } + + /** + * @param Collection $inventorySets + */ + public function setInventorySets($inventorySets) + { + $this->inventorySets = $inventorySets; + } } diff --git a/src/AppBundle/Entity/Rebrickable/Inventory_Set.php b/src/AppBundle/Entity/Rebrickable/Inventory_Set.php index 13d8acd..bb2e67f 100644 --- a/src/AppBundle/Entity/Rebrickable/Inventory_Set.php +++ b/src/AppBundle/Entity/Rebrickable/Inventory_Set.php @@ -15,7 +15,7 @@ class Inventory_Set /** * @var Inventory * @ORM\Id - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Inventory", inversedBy="inventoryParts") + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Inventory", inversedBy="inventorySets") */ protected $inventory; diff --git a/src/AppBundle/Entity/Rebrickable/Set.php b/src/AppBundle/Entity/Rebrickable/Set.php index 74d567c..7a56ff4 100644 --- a/src/AppBundle/Entity/Rebrickable/Set.php +++ b/src/AppBundle/Entity/Rebrickable/Set.php @@ -60,6 +60,7 @@ class Set public function __construct() { $this->inventories = new ArrayCollection(); + $this->inventorySets = new ArrayCollection(); } /** diff --git a/src/AppBundle/Service/Loader/RebrickableLoaderService.php b/src/AppBundle/Service/Loader/RebrickableLoaderService.php index 0af4394..5f9c0a4 100644 --- a/src/AppBundle/Service/Loader/RebrickableLoaderService.php +++ b/src/AppBundle/Service/Loader/RebrickableLoaderService.php @@ -45,8 +45,9 @@ class RebrickableLoaderService extends BaseLoaderService private function truncateTables() { - $query = - 'TRUNCATE TABLE rebrickable_inventory_parts; + $query =' + TRUNCATE TABLE rebrickable_inventory_parts; + TRUNCATE TABLE rebrickable_inventory_sets; TRUNCATE TABLE rebrickable_color; TRUNCATE TABLE rebrickable_inventory; TRUNCATE TABLE rebrickable_set;