src/Entity/Categories3.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Categories3Repository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCategories3Repository::class)]
  8. class Categories3
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityCategories2::class, inversedBy'categories3')]
  15.     private $category2;
  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\Column(type'string'length255nullabletrue)]
  25.     private $slug;
  26.     #[ORM\Column(type'array'nullabletrue)]
  27.     private $tagsArray;
  28.     #[ORM\OneToMany(targetEntityProducts::class, mappedBy'category3')]
  29.     private $products;
  30.     #[ORM\Column(type'integer'nullabletrue)]
  31.     private $productCount;
  32.     public function __construct()
  33.     {
  34.         $this->setCreated(new \DateTime());
  35.         if ($this->getModified() == null) {
  36.             $this->setModified(new \DateTime());
  37.         }
  38.         $this->products = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getCategory2(): ?Categories2
  45.     {
  46.         return $this->category2;
  47.     }
  48.     public function setCategory2(?Categories2 $category2): self
  49.     {
  50.         $this->category2 $category2;
  51.         return $this;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function getTags(): ?array
  63.     {
  64.         return $this->tags;
  65.     }
  66.     public function setTags(array $tags): self
  67.     {
  68.         $this->tags $tags;
  69.         return $this;
  70.     }
  71.     public function getModified(): ?\DateTimeInterface
  72.     {
  73.         return $this->modified;
  74.     }
  75.     public function setModified(\DateTimeInterface $modified): self
  76.     {
  77.         $this->modified $modified;
  78.         return $this;
  79.     }
  80.     public function getCreated(): ?\DateTimeInterface
  81.     {
  82.         return $this->created;
  83.     }
  84.     public function setCreated(\DateTimeInterface $created): self
  85.     {
  86.         $this->created $created;
  87.         return $this;
  88.     }
  89.     public function getSlug(): ?string
  90.     {
  91.         return $this->slug;
  92.     }
  93.     public function setSlug(?string $slug): self
  94.     {
  95.         $this->slug $slug;
  96.         return $this;
  97.     }
  98.     public function getTagsArray(): ?array
  99.     {
  100.         return $this->tagsArray;
  101.     }
  102.     public function setTagsArray(array $tagsArray): self
  103.     {
  104.         $this->tagsArray $tagsArray;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, Products>
  109.      */
  110.     public function getProducts(): Collection
  111.     {
  112.         return $this->products;
  113.     }
  114.     public function addProduct(Products $product): self
  115.     {
  116.         if (!$this->products->contains($product)) {
  117.             $this->products[] = $product;
  118.             $product->setCategory3($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeProduct(Products $product): self
  123.     {
  124.         if ($this->products->removeElement($product)) {
  125.             // set the owning side to null (unless already changed)
  126.             if ($product->getCategory3() === $this) {
  127.                 $product->setCategory3(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     public function getProductCount(): ?int
  133.     {
  134.         return $this->productCount;
  135.     }
  136.     public function setProductCount(?int $productCount): self
  137.     {
  138.         $this->productCount $productCount;
  139.         return $this;
  140.     }
  141. }