src/Entity/BlogArticle.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Repository\BlogArticleRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. #[ORM\Entity(repositoryClassBlogArticleRepository::class)]
  12. class BlogArticle implements TranslatableInterface
  13. {
  14.     use TranslatableTrait;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\ManyToMany(targetEntityBlogCategorie::class, inversedBy'blogArticles')]
  20.     private Collection $categories;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $metaTitre null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $metaDesc null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $image null;
  27.     #[ORM\Column(nullabletrue)]
  28.     private ?bool $isActive null;
  29.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  30.     private ?\DateTimeInterface $datePublication null;
  31.     #[ORM\ManyToOne(inversedBy'blogArticles')]
  32.     private ?User $auteur null;
  33.     public function __construct()
  34.     {
  35.         $this->categories = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     /**
  42.      * @return Collection<int, BlogCategorie>
  43.      */
  44.     public function getCategories(): Collection
  45.     {
  46.         return $this->categories;
  47.     }
  48.     public function addCategory(BlogCategorie $category): static
  49.     {
  50.         if (!$this->categories->contains($category)) {
  51.             $this->categories->add($category);
  52.         }
  53.         return $this;
  54.     }
  55.     public function removeCategory(BlogCategorie $category): static
  56.     {
  57.         $this->categories->removeElement($category);
  58.         return $this;
  59.     }
  60.     public function getMetaTitre(): ?string
  61.     {
  62.         return $this->metaTitre;
  63.     }
  64.     public function setMetaTitre(?string $metaTitre): static
  65.     {
  66.         $this->metaTitre $metaTitre;
  67.         return $this;
  68.     }
  69.     public function getMetaDesc(): ?string
  70.     {
  71.         return $this->metaDesc;
  72.     }
  73.     public function setMetaDesc(?string $metaDesc): static
  74.     {
  75.         $this->metaDesc $metaDesc;
  76.         return $this;
  77.     }
  78.     public function getImage(): ?string
  79.     {
  80.         return $this->image;
  81.     }
  82.     public function setImage(?string $image): static
  83.     {
  84.         $this->image $image;
  85.         return $this;
  86.     }
  87.     public function isIsActive(): ?bool
  88.     {
  89.         return $this->isActive;
  90.     }
  91.     public function setIsActive(?bool $isActive): static
  92.     {
  93.         $this->isActive $isActive;
  94.         return $this;
  95.     }
  96.     public function getDatePublication(): ?\DateTimeInterface
  97.     {
  98.         return $this->datePublication;
  99.     }
  100.     public function setDatePublication(?\DateTimeInterface $datePublication): static
  101.     {
  102.         $this->datePublication $datePublication;
  103.         return $this;
  104.     }
  105.     public function getAuteur(): ?User
  106.     {
  107.         return $this->auteur;
  108.     }
  109.     public function setAuteur(?User $auteur): static
  110.     {
  111.         $this->auteur $auteur;
  112.         return $this;
  113.     }
  114. }