src/Mm/Beton/Planungsatlas/AtlasBundle/Entity/Main/ConstructionType.php line 16

Open in your IDE?
  1. <?php
  2. namespace Mm\Beton\Planungsatlas\AtlasBundle\Entity\Main;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Exception;
  6. /**
  7.  * Class ConstructionType
  8.  *
  9.  * @package Mm\Beton\Planungsatlas\AtlasBundle\Entity
  10.  * @ORM\Entity
  11.  * @ORM\Table(name="construction_types")
  12.  */
  13. class ConstructionType extends AbstractModel implements HasParentModelInterface
  14. {
  15.     /**
  16.      * @ORM\Column(type="integer")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @var ArrayCollection
  27.      * @ORM\OneToMany(targetEntity="ConstructionElement", mappedBy="constructionType")
  28.      */
  29.     private $constructionElements;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity="Construction", inversedBy="constructionTypes")
  32.      * @ORM\JoinColumn(name="construction_id", referencedColumnName="id", nullable=false)
  33.      */
  34.     private $construction;
  35.     /**
  36.      * Constructor
  37.      */
  38.     public function __construct()
  39.     {
  40.         $this->constructionElements = new ArrayCollection();
  41.     }
  42.     /**
  43.      * @return mixed
  44.      */
  45.     public function getId()
  46.     {
  47.         return $this->id;
  48.     }
  49.     /**
  50.      * @param mixed $id
  51.      */
  52.     public function setId($id)
  53.     {
  54.         $this->id $id;
  55.     }
  56.     /**
  57.      * @return mixed
  58.      */
  59.     public function getName()
  60.     {
  61.         return $this->name;
  62.     }
  63.     /**
  64.      * @param mixed $name
  65.      */
  66.     public function setName($name)
  67.     {
  68.         $this->name $name;
  69.     }
  70.     /**
  71.      * @return ConstructionElement[]
  72.      */
  73.     public function getConstructionElements()
  74.     {
  75.         return $this->constructionElements;
  76.     }
  77.     /**
  78.      * @param ConstructionElement[] $constructionElements
  79.      */
  80.     public function setConstructionElements(ArrayCollection $constructionElements)
  81.     {
  82.         $this->constructionElements $constructionElements;
  83.     }
  84.     /**
  85.      * @return Construction
  86.      */
  87.     public function getConstruction()
  88.     {
  89.         return $this->construction;
  90.     }
  91.     /**
  92.      * @param Construction $construction
  93.      */
  94.     public function setConstruction($construction)
  95.     {
  96.         $this->construction $construction;
  97.     }
  98.     /**
  99.      * {@inheritdoc}
  100.      */
  101.     public function setParentModel($parentModel)
  102.     {
  103.         if (!($parentModel instanceof Construction)) {
  104.             throw new Exception('invalid parent');
  105.         }
  106.         $this->setConstruction($parentModel);
  107.     }
  108. }