<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\BlogArticleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
#[ORM\Entity(repositoryClass: BlogArticleRepository::class)]
class BlogArticle implements TranslatableInterface
{
use TranslatableTrait;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToMany(targetEntity: BlogCategorie::class, inversedBy: 'blogArticles')]
private Collection $categories;
#[ORM\Column(length: 255, nullable: true)]
private ?string $metaTitre = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $metaDesc = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(nullable: true)]
private ?bool $isActive = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $datePublication = null;
#[ORM\ManyToOne(inversedBy: 'blogArticles')]
private ?User $auteur = null;
public function __construct()
{
$this->categories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, BlogCategorie>
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(BlogCategorie $category): static
{
if (!$this->categories->contains($category)) {
$this->categories->add($category);
}
return $this;
}
public function removeCategory(BlogCategorie $category): static
{
$this->categories->removeElement($category);
return $this;
}
public function getMetaTitre(): ?string
{
return $this->metaTitre;
}
public function setMetaTitre(?string $metaTitre): static
{
$this->metaTitre = $metaTitre;
return $this;
}
public function getMetaDesc(): ?string
{
return $this->metaDesc;
}
public function setMetaDesc(?string $metaDesc): static
{
$this->metaDesc = $metaDesc;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): static
{
$this->image = $image;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): static
{
$this->isActive = $isActive;
return $this;
}
public function getDatePublication(): ?\DateTimeInterface
{
return $this->datePublication;
}
public function setDatePublication(?\DateTimeInterface $datePublication): static
{
$this->datePublication = $datePublication;
return $this;
}
public function getAuteur(): ?User
{
return $this->auteur;
}
public function setAuteur(?User $auteur): static
{
$this->auteur = $auteur;
return $this;
}
}