src/Entity/CheckType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\CheckTypeRepository")
  8.  * @ORM\Table(name="check_types", indexes={@ORM\Index(name="id_index", columns={"id"})})
  9.  */
  10. class CheckType
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\Column(type="integer")
  15.      * @ORM\GeneratedValue(strategy="AUTO")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", unique=true, length=25, nullable=false)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=false)
  24.      */
  25.     private $status;
  26.     /**
  27.      * @ORM\ManyToMany(targetEntity="App\Entity\Customer", mappedBy="checkTypes")
  28.      */
  29.     private $customers;
  30.     /**
  31.      * @ORM\ManyToMany(targetEntity="App\Entity\Brand", mappedBy="checkTypes")
  32.      */
  33.     private $brands;
  34.     public function __construct()
  35.     {
  36.         $this->customers = new ArrayCollection();
  37.         $this->brands = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getStatus(): ?bool
  53.     {
  54.         return $this->status;
  55.     }
  56.     public function setStatus(bool $status): self
  57.     {
  58.         $this->status $status;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection|Customer[]
  63.      */
  64.     public function getCustomers(): Collection
  65.     {
  66.         return $this->customers;
  67.     }
  68.     public function addCustomer(Customer $customer): self
  69.     {
  70.         if (!$this->customers->contains($customer)) {
  71.             $this->customers[] = $customer;
  72.             $customer->addCheckType($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeCustomer(Customer $customer): self
  77.     {
  78.         if ($this->customers->removeElement($customer)) {
  79.             $customer->removeCheckType($this);
  80.         }
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection|Brand[]
  85.      */
  86.     public function getBrands(): Collection
  87.     {
  88.         return $this->brands;
  89.     }
  90.     public function addBrand(Brand $brand): self
  91.     {
  92.         if (!$this->brands->contains($brand)) {
  93.             $this->brands[] = $brand;
  94.             $brand->addCheckType($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeBrand(Brand $brand): self
  99.     {
  100.         if ($this->brands->removeElement($brand)) {
  101.             $brand->removeCheckType($this);
  102.         }
  103.         return $this;
  104.     }
  105. }