<?phpnamespace App\Entity;use App\Repository\BlogCategoryRepository;use App\Traits\CommonTrt;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=BlogCategoryRepository::class) */class BlogCategory{ use CommonTrt; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="string", length=255) */ private $slug; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\Column(type="boolean") */ private $isActive; /** * @ORM\OneToMany(targetEntity=Blog::class, mappedBy="category") */ private $blog; public function __construct() { $this->blogs = new ArrayCollection(); $this->blog = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function isIsActive(): ?bool { return $this->isActive; } public function setIsActive(bool $isActive): self { $this->isActive = $isActive; return $this; } /** * @return Collection<int, Blog> */ public function getBlogs(): Collection { return $this->blogs; } public function addBlog(Blog $blog): self { if (!$this->blogs->contains($blog)) { $this->blogs[] = $blog; $blog->addCategory($this); } return $this; } public function removeBlog(Blog $blog): self { if ($this->blogs->removeElement($blog)) { $blog->removeCategory($this); } return $this; } /** * @return Collection<int, Blog> */ public function getBlog(): Collection { return $this->blog; }}