diff --git a/src/AppBundle/Entity/Rebrickable/Category.php b/src/AppBundle/Entity/Rebrickable/Category.php index 448f713..8bd8181 100644 --- a/src/AppBundle/Entity/Rebrickable/Category.php +++ b/src/AppBundle/Entity/Rebrickable/Category.php @@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Category. * - * @ORM\Table(name="category") + * @ORM\Table(name="rebrickable_category") * @ORM\Entity */ class Category @@ -21,21 +21,21 @@ class Category * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ - private $id; + protected $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255, unique=true) */ - private $name; + protected $name; /** * @var Collection * * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Part", mappedBy="category") */ - private $parts; + protected $parts; /** * BuildingKit constructor. diff --git a/src/AppBundle/Entity/Rebrickable/Color.php b/src/AppBundle/Entity/Rebrickable/Color.php index 5055a1b..7fa803e 100644 --- a/src/AppBundle/Entity/Rebrickable/Color.php +++ b/src/AppBundle/Entity/Rebrickable/Color.php @@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Color. * - * @ORM\Table(name="color") + * @ORM\Table(name="rebrickable_color") * @ORM\Entity */ class Color @@ -20,42 +20,42 @@ class Color * @ORM\Column(name="id", type="integer") * @ORM\Id */ - private $id; + protected $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255, unique=true) */ - private $name; + protected $name; /** * @var string * * @ORM\Column(name="rgb", type="string", length=6, unique=false) */ - private $rgb; + protected $rgb; /** * @var bool * * @ORM\Column(name="transparent", type="boolean") */ - private $transparent; + protected $transparent; /** * @var Collection * - * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Part_Set", mappedBy="color") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_part", mappedBy="color") */ - private $part_sets; + protected $inventoryParts; /** * Constructor. */ public function __construct() { - $this->part_sets = new ArrayCollection(); + $this->inventoryParts = new ArrayCollection(); } /** @@ -153,31 +153,31 @@ class Color /** * @return Collection */ - public function getPartBuildingKits() + public function getPartInventoryParts() { - return $this->part_sets; + return $this->inventoryParts; } /** - * @param Part_Set $part_building_kit + * @param Inventory_Part $part_building_kit * * @return Color */ - public function addPartBuildingKit(Part_Set $part_set) + public function addPartInventoryPart(Inventory_Part $inventoryPart) { - $this->part_sets->add($part_set); + $this->inventoryParts->add($inventoryPart); return $this; } /** - * @param Part_Set $part_building_kit + * @param Inventory_Part $part_building_kit * * @return Color */ - public function removePartBuildingKit(Part_Set $part_set) + public function removePartInventoryPart(Inventory_Part $inventoryPart) { - $this->part_sets->remove($part_set); + $this->inventoryParts->remove($inventoryPart); return $this; } diff --git a/src/AppBundle/Entity/Rebrickable/Inventory.php b/src/AppBundle/Entity/Rebrickable/Inventory.php new file mode 100644 index 0000000..e0a912a --- /dev/null +++ b/src/AppBundle/Entity/Rebrickable/Inventory.php @@ -0,0 +1,116 @@ +inventoryParts = new ArrayCollection(); + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return int + */ + public function getVersion() + { + return $this->version; + } + + /** + * @param int $version + */ + public function setVersion($version) + { + $this->version = $version; + } + + /** + * @return Set + */ + public function getSet() + { + return $this->set; + } + + /** + * @param Set $set + */ + public function setSet($set) + { + $this->set = $set; + } + + /** + * @return Collection + */ + public function getInventoryParts() + { + return $this->inventoryParts; + } + + /** + * @param Inventory_Part $inventoryParts + */ + public function setInventoryParts($inventoryParts) + { + $this->inventoryParts = $inventoryParts; + } +} diff --git a/src/AppBundle/Entity/Rebrickable/Part_Set.php b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php similarity index 58% rename from src/AppBundle/Entity/Rebrickable/Part_Set.php rename to src/AppBundle/Entity/Rebrickable/Inventory_Part.php index 60c2233..c7b06d4 100644 --- a/src/AppBundle/Entity/Rebrickable/Part_Set.php +++ b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php @@ -5,73 +5,54 @@ namespace AppBundle\Entity\Rebrickable; use Doctrine\ORM\Mapping as ORM; /** - * Part_Set. + * Inventory_Part. * - * @ORM\Table(name="part_set") + * @ORM\Table(name="rebrickable_inventory_parts") * @ORM\Entity */ -class Part_Set +class Inventory_Part { /** * @var int * - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer") */ - private $id; - - /** - * @var int - * - * @ORM\Column(name="count", type="integer") - */ - private $count; + protected $quantity; /** * @var Color - * - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Color", inversedBy="part_sets") + * @ORM\Id + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Color", inversedBy="inventoryParts") */ - private $color; + protected $color; /** * @var bool * - * @ORM\Column(name="type", type="boolean") + * @ORM\Column(type="boolean") */ - private $type; + protected $isSpare; /** * @var Part - * - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Part", inversedBy="sets" ) + * @ORM\Id + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Part", inversedBy="inventoryParts") */ - private $part; + protected $part; /** - * @var Set - * - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Set", inversedBy="parts") + * @var Inventory + * @ORM\Id + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Inventory", inversedBy="inventoryParts") */ - private $set; - - /** - * Get id. - * - * @return int - */ - public function getId() - { - return $this->id; - } + protected $inventory; /** * Set count. * * @param int $count * - * @return Part_Set + * @return Inventory_Part */ public function setCount($count) { @@ -85,9 +66,9 @@ class Part_Set * * @return int */ - public function getCount() + public function getQuantity() { - return $this->count; + return $this->quantity; } /** @@ -95,7 +76,7 @@ class Part_Set * * @param Color $color * - * @return Part_Set + * @return Inventory_Part */ public function setColor($color) { @@ -119,11 +100,11 @@ class Part_Set * * @param bool $type * - * @return Part_Set + * @return Inventory_Part */ - public function setType($type) + public function setIsSpare($isSpare) { - $this->type = $type; + $this->isSpare = $isSpare; return $this; } @@ -133,9 +114,9 @@ class Part_Set * * @return bool */ - public function getType() + public function isSpare() { - return $this->type; + return $this->isSpare(); } /** @@ -149,11 +130,10 @@ class Part_Set /** * @param Part $part * - * @return Part_Set + * @return Inventory_Part */ public function setPart(Part $part) { - $part->addSet($this); $this->part = $part; return $this; @@ -162,20 +142,19 @@ class Part_Set /** * @return Set */ - public function getSet() + public function getInventory() { - return $this->set; + return $this->inventory; } /** - * @param Set $set + * @param Inventory $inventory * - * @return Part_Set + * @return Inventory_Part */ - public function setSet(Set $set) + public function setInventory(Inventory $inventory) { - $set->addPart($this); - $this->set = $set; + $this->inventory = $inventory; return $this; } diff --git a/src/AppBundle/Entity/Rebrickable/Part.php b/src/AppBundle/Entity/Rebrickable/Part.php index 61cae98..90f0da5 100644 --- a/src/AppBundle/Entity/Rebrickable/Part.php +++ b/src/AppBundle/Entity/Rebrickable/Part.php @@ -9,20 +9,11 @@ use Doctrine\ORM\Mapping as ORM; /** * Part. * - * @ORM\Table(name="part") + * @ORM\Table(name="rebrickable_part") * @ORM\Entity */ class Part { - // /** -// * @var int -// * -// * @ORM\Column(name="id", type="integer") -// * @ORM\Id -// * @ORM\GeneratedValue(strategy="AUTO") -// */ -// private $id; - /** * Part ID number. * @@ -31,35 +22,35 @@ class Part * @ORM\Id * @ORM\Column(name="id", type="string", length=255, unique=true) */ - private $number; + protected $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255) */ - private $name; + protected $name; /** * @var Category * * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Category", inversedBy="parts") */ - private $category; + protected $category; /** * @var Collection * - * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Part_Set", mappedBy="part") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_Part", mappedBy="part") */ - private $sets; + protected $inventoryParts; /** * Part constructor. */ public function __construct() { - $this->sets = new ArrayCollection(); + $this->inventoryParts = new ArrayCollection(); } /** @@ -69,9 +60,9 @@ class Part * * @return Part */ - public function setNumber($number) + public function setId($id) { - $this->number = $number; + $this->id = $id; return $this; } @@ -81,9 +72,9 @@ class Part * * @return string */ - public function getNumber() + public function getId() { - return $this->number; + return $this->id; } /** @@ -111,33 +102,33 @@ class Part } /** - * @return mixed + * @return Collection */ - public function getSets() + public function getInventoryParts() { - return $this->sets; + return $this->inventoryParts; } /** - * @param Part_Set $set + * @param Inventory_Part $invetoryPart * * @return Part */ - public function addSet(Part_Set $set) + public function addInventoryPart(Inventory_Part $inventoryPart) { - $this->sets->add($set); + $this->inventoryParts->add($inventoryPart); return $this; } /** - * @param Part_Set $set + * @param Inventory_Part $set * * @return Part */ - public function removeSet($set) + public function removeInventoryPart($inventoryPart) { - $this->sets->removeElement($set); + $this->inventoryParts->removeElement($inventoryPart); return $this; } diff --git a/src/AppBundle/Entity/Rebrickable/Set.php b/src/AppBundle/Entity/Rebrickable/Set.php index 38b5939..ab83694 100644 --- a/src/AppBundle/Entity/Rebrickable/Set.php +++ b/src/AppBundle/Entity/Rebrickable/Set.php @@ -9,82 +9,62 @@ use Doctrine\ORM\Mapping as ORM; /** * Set. * - * @ORM\Table(name="set") + * @ORM\Table(name="rebrickable_set") * @ORM\Entity */ class Set { - // /** -// * @var int -// * -// * @ORM\Column(name="id", type="integer") -// * @ORM\Id -// * @ORM\GeneratedValue(strategy="AUTO") -// */ -// private $id; - /** * @var string * * @ORM\Id * @ORM\Column(name="id", type="string", length=255, unique=true) */ - private $number; + protected $number; /** * @var string * * @ORM\Column(name="name", type="string", length=255, nullable=true) */ - private $name; + protected $name; /** * @var int * * @ORM\Column(name="year", type="integer", nullable=true) */ - private $year; + protected $year; /** * @var int * - * @ORM\Column(name="part_count", type="integer", nullable=true) + * @ORM\Column(name="num_parts", type="integer", nullable=true) */ - private $partCount; + protected $partCount; /** * @var Collection * - * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Part_Set", mappedBy="set") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory", mappedBy="set") */ - private $parts; + protected $inventories; /** - * @var Collection + * @var Theme * - * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Rebrickable\Theme", mappedBy="sets") + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Theme", inversedBy="sets") */ - private $themes; + protected $theme; /** * Set constructor. */ public function __construct() { - $this->parts = new ArrayCollection(); - $this->themes = new ArrayCollection(); + $this->inventories = new ArrayCollection(); } -// /** -// * Get id. -// * -// * @return int -// */ -// public function getId() -// { -// return $this->id; -// } - /** * @return string */ @@ -178,32 +158,48 @@ class Set * * @return Collection */ - public function getParts() + public function getInventories() { - return $this->parts; + return $this->inventories; } /** - * @param Part_Set $part + * @param Inventory $inventory * * @return Set */ - public function addPart(Part_Set $part) + public function addInventory(Inventory $inventory) { - $this->parts->add($part); + $this->inventories->add($inventory); return $this; } /** - * @param Part_Set $part + * @param Inventory $part * * @return Set */ - public function removePart(Part_Set $part) + public function removeInventory(Inventory $inventory) { - $this->parts->remove($part); + $this->inventories->removeElement($inventory); return $this; } + + /** + * @return Theme + */ + public function getTheme() + { + return $this->theme; + } + + /** + * @param Theme $theme + */ + public function setTheme($theme) + { + $this->theme = $theme; + } } diff --git a/src/AppBundle/Entity/Rebrickable/Theme.php b/src/AppBundle/Entity/Rebrickable/Theme.php index 7a6c600..b0ddfb0 100644 --- a/src/AppBundle/Entity/Rebrickable/Theme.php +++ b/src/AppBundle/Entity/Rebrickable/Theme.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Theme. * - * @ORM\Table(name="theme") + * @ORM\Table(name="rebrickable_theme") * @ORM\Entity */ class Theme @@ -16,32 +16,32 @@ class Theme /** * @var int * - * @ORM\Column(name="id", type="integer") + * @ORM\Column(type="integer") * @ORM\Id */ - private $id; + protected $id; /** * @var string * - * @ORM\Column(name="name", type="string", length=255) + * @ORM\Column(type="string", length=255) */ - private $name; + protected $name; /** - * @var Collection + * @var Theme * * @ORM\ManyToOne(targetEntity="Theme") * @ORM\JoinColumn(onDelete="SET NULL") */ - private $parent; + protected $parent; /** * @var Collection * - * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Rebrickable\Set", inversedBy="themes") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Set", mappedBy="theme") */ - private $sets; + protected $sets; /** * @return int @@ -76,7 +76,7 @@ class Theme } /** - * @return Collection + * @return Theme */ public function getParent() { @@ -100,11 +100,11 @@ class Theme } /** - * @param Part_Set $set + * @param Set $set * * @return Theme */ - public function addSet(Part_Set $set) + public function addSet(Set $set) { $this->sets->add($set); @@ -112,7 +112,7 @@ class Theme } /** - * @param Part_Set $set + * @param Set $set * * @return Theme */