<?php
namespace App\Entity;
use App\Repository\Categories3Repository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: Categories3Repository::class)]
class Categories3
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Categories2::class, inversedBy: 'categories3')]
private $category2;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'json', nullable: true)]
private $tags = [];
#[ORM\Column(type: 'datetime')]
private $modified;
#[ORM\Column(type: 'datetime')]
private $created;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $slug;
#[ORM\Column(type: 'array', nullable: true)]
private $tagsArray;
#[ORM\OneToMany(targetEntity: Products::class, mappedBy: 'category3')]
private $products;
#[ORM\Column(type: 'integer', nullable: true)]
private $productCount;
public function __construct()
{
$this->setCreated(new \DateTime());
if ($this->getModified() == null) {
$this->setModified(new \DateTime());
}
$this->products = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCategory2(): ?Categories2
{
return $this->category2;
}
public function setCategory2(?Categories2 $category2): self
{
$this->category2 = $category2;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getTags(): ?array
{
return $this->tags;
}
public function setTags(array $tags): self
{
$this->tags = $tags;
return $this;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getTagsArray(): ?array
{
return $this->tagsArray;
}
public function setTagsArray(array $tagsArray): self
{
$this->tagsArray = $tagsArray;
return $this;
}
/**
* @return Collection<int, Products>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Products $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setCategory3($this);
}
return $this;
}
public function removeProduct(Products $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getCategory3() === $this) {
$product->setCategory3(null);
}
}
return $this;
}
public function getProductCount(): ?int
{
return $this->productCount;
}
public function setProductCount(?int $productCount): self
{
$this->productCount = $productCount;
return $this;
}
}