mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-17 04:40:08 -07:00
Add orm rebrickable entites
Add entities used to persist data from rebrickable
This commit is contained in:
parent
3cbb10c957
commit
05f8681b0c
244
src/AppBundle/Entity/BuildingKit.php
Normal file
244
src/AppBundle/Entity/BuildingKit.php
Normal file
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* BuildingKit
|
||||
*
|
||||
* @ORM\Table(name="building_kit")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\BuildingKitRepository")
|
||||
*/
|
||||
class BuildingKit
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="number", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $number;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="year", type="integer", nullable=true)
|
||||
*/
|
||||
private $year;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="part_count", type="integer", nullable=true)
|
||||
*/
|
||||
private $partCount;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Part_BuildingKit", mappedBy="building_kit")
|
||||
*/
|
||||
private $parts;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Keyword", mappedBy="building_kits")
|
||||
*/
|
||||
private $keywords;
|
||||
|
||||
/**
|
||||
* BuildingKit constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->parts = new ArrayCollection();
|
||||
$this->keywords = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $number
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set year
|
||||
*
|
||||
* @param integer $year
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function setYear($year)
|
||||
{
|
||||
$this->year = $year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get year
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getYear()
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPartCount()
|
||||
{
|
||||
return $this->partCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $partCount
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function setPartCount($partCount)
|
||||
{
|
||||
$this->partCount = $partCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parts
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getParts()
|
||||
{
|
||||
return $this->parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part_BuildingKit $part
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function addPart(Part_BuildingKit $part)
|
||||
{
|
||||
$this->parts->add($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part_BuildingKit $part
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function removePart(Part_BuildingKit $part)
|
||||
{
|
||||
$this->parts->remove($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keywords
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Keyword $keyword
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function addKeyword(Keyword $keyword)
|
||||
{
|
||||
$this->keywords->add($keyword);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Keyword $keyword
|
||||
*
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function removeKeyword(Keyword $keyword)
|
||||
{
|
||||
$this->keywords->remove($keyword);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
159
src/AppBundle/Entity/Category.php
Normal file
159
src/AppBundle/Entity/Category.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* @ORM\Table(name="category")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\CategoryRepository")
|
||||
*/
|
||||
class Category
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Model", mappedBy="category")
|
||||
*/
|
||||
private $models;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Part", mappedBy="category")
|
||||
*/
|
||||
private $parts;
|
||||
|
||||
/**
|
||||
* BuildingKit constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->models = new ArrayCollection();
|
||||
$this->parts = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get models
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getModels()
|
||||
{
|
||||
return $this->models;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function addModel(Model $model)
|
||||
{
|
||||
$this->models->add($model);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function removeModel(Model $model)
|
||||
{
|
||||
$this->models->remove($model);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parts
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getParts()
|
||||
{
|
||||
return $this->parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part $part
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function addPart(Part $part)
|
||||
{
|
||||
$this->parts->add($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part $part
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function removePart(Part $part)
|
||||
{
|
||||
$this->parts->remove($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
158
src/AppBundle/Entity/Color.php
Normal file
158
src/AppBundle/Entity/Color.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Color
|
||||
*
|
||||
* @ORM\Table(name="color")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ColorRepository")
|
||||
*/
|
||||
class Color
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="rgb", type="string", length=6, unique=false)
|
||||
*/
|
||||
private $rgb;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Part_BuildingKit", mappedBy="color")
|
||||
*/
|
||||
private $part_building_kits;
|
||||
|
||||
/**
|
||||
* Set id
|
||||
*
|
||||
* @var int
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rgb
|
||||
*
|
||||
* @param string $rgb
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function setRgb($rgb)
|
||||
{
|
||||
$this->rgb = $rgb;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rgb
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRgb()
|
||||
{
|
||||
return $this->rgb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPartBuildingKits()
|
||||
{
|
||||
return $this->part_building_kits;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Part_BuildingKit $part_building_kit
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function addPartBuildingKit(Part_BuildingKit $part_building_kit)
|
||||
{
|
||||
$this->part_building_kits->add($part_building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part_BuildingKit $part_building_kit
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function removePartBuildingKit(Part_BuildingKit $part_building_kit)
|
||||
{
|
||||
$this->part_building_kits->remove($part_building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->part_building_kits = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
}
|
114
src/AppBundle/Entity/Keyword.php
Normal file
114
src/AppBundle/Entity/Keyword.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Keyword
|
||||
*
|
||||
* @ORM\Table(name="keyword")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\KeywordRepository")
|
||||
*/
|
||||
class Keyword
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\BuildingKit", inversedBy="keywords")
|
||||
*/
|
||||
private $building_kits;
|
||||
|
||||
/**
|
||||
* Keyword constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->building_kits = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Keyword
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getBuildingKits()
|
||||
{
|
||||
return $this->building_kits;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BuildingKit $building_kit
|
||||
*
|
||||
* @return Keyword
|
||||
*/
|
||||
public function addBuildingKit(BuildingKit $building_kit)
|
||||
{
|
||||
$this->building_kits->add($building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BuildingKit $building_kit
|
||||
*
|
||||
* @return Keyword
|
||||
*/
|
||||
public function removeBuildingKit(BuildingKit $building_kit)
|
||||
{
|
||||
$this->building_kits->remove($building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
201
src/AppBundle/Entity/Model.php
Normal file
201
src/AppBundle/Entity/Model.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Model
|
||||
*
|
||||
* @ORM\Table(name="model")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ModelRepository")
|
||||
*/
|
||||
class Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="number", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $number;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="author", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $author;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file", type="string", length=255, unique=true, nullable=true)
|
||||
*/
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Part", mappedBy="model")
|
||||
*/
|
||||
private $parts;
|
||||
|
||||
/**
|
||||
* @var Category
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Category", inversedBy="models")
|
||||
*/
|
||||
private $category;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set number
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set author
|
||||
*
|
||||
* @param string $author
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
$this->author = $author;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get author
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parts
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getParts()
|
||||
{
|
||||
return $this->parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part $part
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function addPart(Part $part)
|
||||
{
|
||||
$this->parts->add($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part $part
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function removePart(Part $part)
|
||||
{
|
||||
$this->parts->remove($part);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set category
|
||||
*
|
||||
* @param Category $category
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function setCategory(Category $category)
|
||||
{
|
||||
$category->addModel($this);
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
}
|
198
src/AppBundle/Entity/Part.php
Normal file
198
src/AppBundle/Entity/Part.php
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Part.
|
||||
*
|
||||
* @ORM\Table(name="part")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\PartRepository")
|
||||
*/
|
||||
class Part
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="number", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $number;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Category
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Category", inversedBy="parts")
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* @var Model
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Model", inversedBy="parts")
|
||||
*/
|
||||
private $model;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Part_BuildingKit", mappedBy="part")
|
||||
*/
|
||||
private $building_kits;
|
||||
|
||||
/**
|
||||
* Part constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->building_kits = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set number.
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Model
|
||||
*/
|
||||
public function getModel()
|
||||
{
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function setModel($model)
|
||||
{
|
||||
$this->model = $model;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBuildingKits()
|
||||
{
|
||||
return $this->building_kits;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part_BuildingKit $building_kit
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function addBuildingKit(Part_BuildingKit $building_kit)
|
||||
{
|
||||
$this->building_kits->add($building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part_BuildingKit $building_kit
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function removeBuildingKit($building_kit)
|
||||
{
|
||||
$this->building_kits->remove($building_kit);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Category
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $category
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function setCategory(Category $category)
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
186
src/AppBundle/Entity/Part_BuildingKit.php
Normal file
186
src/AppBundle/Entity/Part_BuildingKit.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Part_BuildingKit
|
||||
*
|
||||
* @ORM\Table(name="part__building_kit")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\Part_BuildingKitRepository")
|
||||
*/
|
||||
class Part_BuildingKit
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="count", type="integer")
|
||||
*/
|
||||
private $count;
|
||||
|
||||
/**
|
||||
* @var Color
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Color", inversedBy="part_building_kits")
|
||||
*/
|
||||
private $color;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
* @ORM\Column(name="type", type="boolean")
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var Part
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Part", inversedBy="building_kits" )
|
||||
*/
|
||||
private $part;
|
||||
|
||||
/**
|
||||
* @var BuildingKit
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\BuildingKit", inversedBy="parts")
|
||||
*/
|
||||
private $building_kit;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set count
|
||||
*
|
||||
* @param integer $count
|
||||
*
|
||||
* @return Part_BuildingKit
|
||||
*/
|
||||
public function setCount($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCount()
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set color
|
||||
*
|
||||
* @param Color $color
|
||||
*
|
||||
* @return Part_BuildingKit
|
||||
*/
|
||||
public function setColor($color)
|
||||
{
|
||||
$this->color = $color;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param boolean $type
|
||||
*
|
||||
* @return Part_BuildingKit
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Part
|
||||
*/
|
||||
public function getPart()
|
||||
{
|
||||
return $this->part;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Part $part
|
||||
*
|
||||
* @return Part_BuildingKit
|
||||
*/
|
||||
public function setPart(Part $part)
|
||||
{
|
||||
$part->addBuildingKit($this);
|
||||
$this->part = $part;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BuildingKit
|
||||
*/
|
||||
public function getBuildingKit()
|
||||
{
|
||||
return $this->building_kit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BuildingKit $building_kit
|
||||
*
|
||||
* @return Part_BuildingKit
|
||||
*/
|
||||
public function setBuildingKit(BuildingKit $building_kit)
|
||||
{
|
||||
$building_kit->addPart($this);
|
||||
$this->building_kit = $building_kit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
26
src/AppBundle/Repository/BuildingKitRepository.php
Normal file
26
src/AppBundle/Repository/BuildingKitRepository.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
use AppBundle\Entity\Part;
|
||||
|
||||
/**
|
||||
* BuildingSetRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class BuildingKitRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
public function findAllByPart(Part $part)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
|
||||
$qb->select('building_kit')
|
||||
->from('AppBundle:BuildingKit', 'building_kit')
|
||||
->innerJoin('building_kit.parts', 'parts')
|
||||
->where('parts.part = :id')->setParameter('id', $part->getId());
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
}
|
15
src/AppBundle/Repository/CategoryRepository.php
Normal file
15
src/AppBundle/Repository/CategoryRepository.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
use AppBundle\Entity\Category;
|
||||
|
||||
/**
|
||||
* CategoryRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class CategoryRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
13
src/AppBundle/Repository/ColorRepository.php
Normal file
13
src/AppBundle/Repository/ColorRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* ColorRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class ColorRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
13
src/AppBundle/Repository/KeywordRepository.php
Normal file
13
src/AppBundle/Repository/KeywordRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* KeywordRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class KeywordRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
13
src/AppBundle/Repository/ModelRepository.php
Normal file
13
src/AppBundle/Repository/ModelRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* ModelRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class ModelRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
13
src/AppBundle/Repository/PartRepository.php
Normal file
13
src/AppBundle/Repository/PartRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* PartRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class PartRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
13
src/AppBundle/Repository/Part_BuildingKitRepository.php
Normal file
13
src/AppBundle/Repository/Part_BuildingKitRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* Part_BuildingKitRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class Part_BuildingKitRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user