src/Entity/Categories1.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Categories1Repository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCategories1Repository::class)]
  8. class Categories1
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private $name;
  16.     #[ORM\Column(type'json'nullabletrue)]
  17.     private $tags = [];
  18.     #[ORM\Column(type'datetime')]
  19.     private $modified;
  20.     #[ORM\Column(type'datetime')]
  21.     private $created;
  22.     #[ORM\OneToMany(targetEntityCategories2::class, mappedBy'category1')]
  23.     private $categories2;
  24.     #[ORM\Column(type'string'length255nullabletrue)]
  25.     private $slug;
  26.     #[ORM\Column(type'integer'nullabletrue)]
  27.     private $productCount;
  28.     #[ORM\OneToMany(targetEntityProducts::class, mappedBy'category')]
  29.     private $products;
  30.     public function __construct()
  31.     {
  32.         $this->setCreated(new \DateTime());
  33.         if ($this->getModified() == null) {
  34.             $this->setModified(new \DateTime());
  35.         }
  36.         $this->categories2 = new ArrayCollection();
  37.         $this->products = 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 getTags(): ?array
  53.     {
  54.         return $this->tags;
  55.     }
  56.     public function setTags(array $tags): self
  57.     {
  58.         $this->tags $tags;
  59.         return $this;
  60.     }
  61.     public function getModified(): ?\DateTimeInterface
  62.     {
  63.         return $this->modified;
  64.     }
  65.     public function setModified(\DateTimeInterface $modified): self
  66.     {
  67.         $this->modified $modified;
  68.         return $this;
  69.     }
  70.     public function getCreated(): ?\DateTimeInterface
  71.     {
  72.         return $this->created;
  73.     }
  74.     public function setCreated(\DateTimeInterface $created): self
  75.     {
  76.         $this->created $created;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, Categories2>
  81.      */
  82.     public function getCategories2(): Collection
  83.     {
  84.         return $this->categories2;
  85.     }
  86.     public function addCategories2(Categories2 $categories2): self
  87.     {
  88.         if (!$this->categories2->contains($categories2)) {
  89.             $this->categories2[] = $categories2;
  90.             $categories2->setCategory1($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeCategories(Categories2 $categories2): self
  95.     {
  96.         if ($this->categories2->removeElement($categories2)) {
  97.             // set the owning side to null (unless already changed)
  98.             if ($categories2->getCategory1() === $this) {
  99.                 $categories2->setCategory1(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     public function getSlug(): ?string
  105.     {
  106.         return $this->slug;
  107.     }
  108.     public function setSlug(?string $slug): self
  109.     {
  110.         $this->slug $slug;
  111.         return $this;
  112.     }
  113.     public function getProductCount(): ?int
  114.     {
  115.         return $this->productCount;
  116.     }
  117.     public function setProductCount(?int $productCount): self
  118.     {
  119.         $this->productCount $productCount;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection<int, Products>
  124.      */
  125.     public function getProducts(): Collection
  126.     {
  127.         return $this->products;
  128.     }
  129.     public function addProduct(Products $product): self
  130.     {
  131.         if (!$this->products->contains($product)) {
  132.             $this->products[] = $product;
  133.             $product->setCategory($this);
  134.         }
  135.         return $this;
  136.     }
  137.     public function removeProduct(Products $product): self
  138.     {
  139.         if ($this->products->removeElement($product)) {
  140.             // set the owning side to null (unless already changed)
  141.             if ($product->getCategory() === $this) {
  142.                 $product->setCategory(null);
  143.             }
  144.         }
  145.         return $this;
  146.     }
  147. }