src/Entity/FenceColorDictionary.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FenceColorDictionaryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Timestampable\Traits\TimestampableEntity;
  8. /**
  9.  * @ORM\Entity(repositoryClass=FenceColorDictionaryRepository::class)
  10.  */
  11. class FenceColorDictionary
  12. {
  13.     /**
  14.      * Hook timestampable behavior
  15.      * updates createdAt, updatedAt fields
  16.      */
  17.     use TimestampableEntity;
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\OneToMany(targetEntity=FenceDictionary::class, mappedBy="fenceColorDictionary")
  26.      */
  27.     private $fence;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $name;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $color;
  36.      /**
  37.      * @ORM\Column(type="string", length=7)
  38.      */
  39.     private $colorHex;
  40.     /**
  41.      * @ORM\Column(type="string", length=255)
  42.      */
  43.     private $type;
  44.     /**
  45.      * @ORM\Column(type="boolean")
  46.      */
  47.     private $isIndividualColor;
  48.     public function __construct()
  49.     {
  50.         $this->fence = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * @return Collection<int, FenceDictionary>
  58.      */
  59.     public function getFence(): Collection
  60.     {
  61.         return $this->fence;
  62.     }
  63.     public function addFence(FenceDictionary $fence): self
  64.     {
  65.         if (!$this->fence->contains($fence)) {
  66.             $this->fence[] = $fence;
  67.             $fence->setFenceColorDictionary($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeFence(FenceDictionary $fence): self
  72.     {
  73.         if ($this->fence->removeElement($fence)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($fence->getFenceColorDictionary() === $this) {
  76.                 $fence->setFenceColorDictionary(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     public function __toString()
  82.     {
  83.         return $this->name;
  84.     }
  85.     public function getName(): ?string
  86.     {
  87.         return $this->name;
  88.     }
  89.     public function setName(string $name): self
  90.     {
  91.         $this->name $name;
  92.         return $this;
  93.     }
  94.     public function getColor(): ?string
  95.     {
  96.         return $this->color;
  97.     }
  98.     public function setColor(string $color): self
  99.     {
  100.         $this->color $color;
  101.         return $this;
  102.     }
  103.     public function getColorHex(): ?string
  104.     {
  105.         return $this->colorHex;
  106.     }
  107.     public function setColorHex(string $colorHex): self
  108.     {
  109.         $this->colorHex $colorHex;
  110.         return $this;
  111.     }
  112.     public function getType(): ?string
  113.     {
  114.         return $this->type;
  115.     }
  116.     public function setType(string $type): self
  117.     {
  118.         $this->type $type;
  119.         return $this;
  120.     }
  121.     public function getIsIndividualColor(): ?bool
  122.     {
  123.         return $this->isIndividualColor;
  124.     }
  125.     public function setIsIndividualColor(bool $isIndividualColor): self
  126.     {
  127.         $this->isIndividualColor $isIndividualColor;
  128.         return $this;
  129.     }
  130. }