src/Entity/Category.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use http\Env;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CategoryRepository::class)
  10.  */
  11. class Category
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $label;
  23.     /**
  24.      * @ORM\Column(type="string", length=10, nullable=true)
  25.      */
  26.     private $code;
  27.     /**
  28.      * @ORM\Column(type="datetime")
  29.      */
  30.     private $creation_date;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=SubCategory::class, mappedBy="category", orphanRemoval=true)
  33.      */
  34.     private $subCategories;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Product::class, mappedBy="category", orphanRemoval=true)
  37.      */
  38.     private $products;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $target;
  43.     /**
  44.      * @ORM\Column(type="boolean")
  45.      */
  46.     private $isSynch true;
  47.     /**
  48.      * @ORM\Column(type="boolean")
  49.      */
  50.     private $deleted false;
  51.     public function __construct()
  52.     {
  53.         $this->subCategories = new ArrayCollection();
  54.         $this->products = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getLabel(): ?string
  61.     {
  62.         return $this->label;
  63.     }
  64.     public function setLabel(string $label): self
  65.     {
  66.         $this->label $label;
  67.         return $this;
  68.     }
  69.     public function getCode(): ?string
  70.     {
  71.         return $this->code;
  72.     }
  73.     public function setCode(?string $code): self
  74.     {
  75.         $this->code $code;
  76.         return $this;
  77.     }
  78.     public function getCreationDate(): ?\DateTimeInterface
  79.     {
  80.         return $this->creation_date;
  81.     }
  82.     public function setCreationDate(\DateTimeInterface $creation_date): self
  83.     {
  84.         $this->creation_date $creation_date;
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, SubCategory>
  89.      */
  90.     public function getSubCategories(): Collection
  91.     {
  92.         return $this->subCategories;
  93.     }
  94.     public function addSubCategory(SubCategory $subCategory): self
  95.     {
  96.         if (!$this->subCategories->contains($subCategory)) {
  97.             $this->subCategories[] = $subCategory;
  98.             $subCategory->setCategory($this);
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeSubCategory(SubCategory $subCategory): self
  103.     {
  104.         if ($this->subCategories->removeElement($subCategory)) {
  105.             // set the owning side to null (unless already changed)
  106.             if ($subCategory->getCategory() === $this) {
  107.                 $subCategory->setCategory(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     /**
  113.      * @return Collection<int, Product>
  114.      */
  115.     public function getProducts(): Collection
  116.     {
  117.         return $this->products;
  118.     }
  119.     public function addProduct(Product $product): self
  120.     {
  121.         if (!$this->products->contains($product)) {
  122.             $this->products[] = $product;
  123.             $product->setCategory($this);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeProduct(Product $product): self
  128.     {
  129.         if ($this->products->removeElement($product)) {
  130.             // set the owning side to null (unless already changed)
  131.             if ($product->getCategory() === $this) {
  132.                 $product->setCategory(null);
  133.             }
  134.         }
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return mixed
  139.      */
  140.     public function getisSynch()
  141.     {
  142.         return $this->isSynch;
  143.     }
  144.     /**
  145.      * @param mixed $isSynch
  146.      */
  147.     public function setisSynch($isSynch): void
  148.     {
  149.         $this->isSynch $isSynch;
  150.     }
  151.     /**
  152.      * @return mixed
  153.      */
  154.     public function getDeleted()
  155.     {
  156.         return $this->deleted;
  157.     }
  158.     /**
  159.      * @param mixed $deleted
  160.      */
  161.     public function setDeleted($deleted): void
  162.     {
  163.         $this->deleted $deleted;
  164.     }
  165.     /**
  166.      * @return mixed
  167.      */
  168.     public function getTarget()
  169.     {
  170.         return $this->target;
  171.     }
  172.     /**
  173.      * @param mixed $target
  174.      */
  175.     public function setTarget($target): void
  176.     {
  177.         $this->target $target;
  178.     }
  179. }