src/Entity/Categories2.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Categories2Repository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCategories2Repository::class)]
  8. class Categories2
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityCategories1::class, inversedBy'categories2')]
  15.     private $category1;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $name;
  18.     #[ORM\Column(type'json'nullabletrue)]
  19.     private $tags = [];
  20.     #[ORM\Column(type'datetime')]
  21.     private $modified;
  22.     #[ORM\Column(type'datetime')]
  23.     private $created;
  24.     #[ORM\OneToMany(targetEntityCategories3::class, mappedBy'category2')]
  25.     private $categories3;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private $slug;
  28.     #[ORM\Column(type'array'nullabletrue)]
  29.     private $tagsArray;
  30.     #[ORM\OneToMany(targetEntityProducts::class, mappedBy'category2')]
  31.     private $products;
  32.     #[ORM\Column(type'integer'nullabletrue)]
  33.     private $productCount;
  34.     public function __construct()
  35.     {
  36.         $this->setCreated(new \DateTime());
  37.         if ($this->getModified() == null) {
  38.             $this->setModified(new \DateTime());
  39.         }
  40.         $this->categories3 = new ArrayCollection();
  41.         $this->products = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getCategory1(): ?Categories1
  48.     {
  49.         return $this->category1;
  50.     }
  51.     public function setCategory1(?Categories1 $category1): self
  52.     {
  53.         $this->category1 $category1;
  54.         return $this;
  55.     }
  56.     public function getName(): ?string
  57.     {
  58.         return $this->name;
  59.     }
  60.     public function setName(string $name): self
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     public function getTags(): ?array
  66.     {
  67.         return $this->tags;
  68.     }
  69.     public function setTags(array $tags): self
  70.     {
  71.         $this->tags $tags;
  72.         return $this;
  73.     }
  74.     public function getModified(): ?\DateTimeInterface
  75.     {
  76.         return $this->modified;
  77.     }
  78.     public function setModified(\DateTimeInterface $modified): self
  79.     {
  80.         $this->modified $modified;
  81.         return $this;
  82.     }
  83.     public function getCreated(): ?\DateTimeInterface
  84.     {
  85.         return $this->created;
  86.     }
  87.     public function setCreated(\DateTimeInterface $created): self
  88.     {
  89.         $this->created $created;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection<int, Categories3>
  94.      */
  95.     public function getCategories3(): Collection
  96.     {
  97.         return $this->categories3;
  98.     }
  99.     public function addCategories3(Categories3 $categories3): self
  100.     {
  101.         if (!$this->categories3->contains($categories3)) {
  102.             $this->categories3[] = $categories3;
  103.             $categories3->setCategory2($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeCategories3(Categories3 $categories3): self
  108.     {
  109.         if ($this->categories3->removeElement($categories3)) {
  110.             // set the owning side to null (unless already changed)
  111.             if ($categories3->getCategory2() === $this) {
  112.                 $categories3->setCategory2(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117.     public function getSlug(): ?string
  118.     {
  119.         return $this->slug;
  120.     }
  121.     public function setSlug(?string $slug): self
  122.     {
  123.         $this->slug $slug;
  124.         return $this;
  125.     }
  126.     public function getTagsArray(): ?array
  127.     {
  128.         return $this->tagsArray;
  129.     }
  130.     public function setTagsArray(array $tagsArray): self
  131.     {
  132.         $this->tagsArray $tagsArray;
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return Collection<int, Products>
  137.      */
  138.     public function getProducts(): Collection
  139.     {
  140.         return $this->products;
  141.     }
  142.     public function addProduct(Products $product): self
  143.     {
  144.         if (!$this->products->contains($product)) {
  145.             $this->products[] = $product;
  146.             $product->setCategory2($this);
  147.         }
  148.         return $this;
  149.     }
  150.     public function removeProduct(Products $product): self
  151.     {
  152.         if ($this->products->removeElement($product)) {
  153.             // set the owning side to null (unless already changed)
  154.             if ($product->getCategory2() === $this) {
  155.                 $product->setCategory2(null);
  156.             }
  157.         }
  158.         return $this;
  159.     }
  160.     public function getProductCount(): ?int
  161.     {
  162.         return $this->productCount;
  163.     }
  164.     public function setProductCount(?int $productCount): self
  165.     {
  166.         $this->productCount $productCount;
  167.         return $this;
  168.     }
  169. }