src/Entity/Article.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ArticleRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass=ArticleRepository::class)
  8.  */
  9. class Article
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      *
  20.      * @Assert\NotBlank(message="Veuillez renseigner le titre de l'article")
  21.      */
  22.     private $title;
  23.     /**
  24.      * @ORM\Column(type="text")
  25.      *
  26.      * @Assert\NotBlank(message="Veuillez ajouter du contenu à l'article")
  27.      */
  28.     private $text;
  29.     /**
  30.      * @ORM\Column(type="datetime")
  31.      */
  32.     private $publishedAt;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $metaTitle;
  37.     /**
  38.      * @ORM\Column(type="text", nullable=true)
  39.      */
  40.     private $metaDescription;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      *
  44.      */
  45.     private $image;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      */
  49.     private $slug;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=BlogCategory::class, inversedBy="articles")
  52.      */
  53.     private $blogCategory;
  54.     public function __construct()
  55.     {
  56.         $this->publishedAt = new \DateTime();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getTitle(): ?string
  63.     {
  64.         return $this->title;
  65.     }
  66.     public function setTitle(string $title): self
  67.     {
  68.         $this->title $title;
  69.         return $this;
  70.     }
  71.     public function getText(): ?string
  72.     {
  73.         return $this->text;
  74.     }
  75.     public function setText(string $text): self
  76.     {
  77.         $this->text $text;
  78.         return $this;
  79.     }
  80.     public function getPublishedAt(): ?\DateTimeInterface
  81.     {
  82.         return $this->publishedAt;
  83.     }
  84.     public function setPublishedAt(\DateTimeInterface $publishedAt): self
  85.     {
  86.         $this->publishedAt $publishedAt;
  87.         return $this;
  88.     }
  89.     public function getMetaTitle(): ?string
  90.     {
  91.         return $this->metaTitle;
  92.     }
  93.     public function setMetaTitle(?string $metaTitle): self
  94.     {
  95.         $this->metaTitle $metaTitle;
  96.         return $this;
  97.     }
  98.     public function getMetaDescription(): ?string
  99.     {
  100.         return $this->metaDescription;
  101.     }
  102.     public function setMetaDescription(?string $metaDescription): self
  103.     {
  104.         $this->metaDescription $metaDescription;
  105.         return $this;
  106.     }
  107.     public function getImage()
  108.     {
  109.         return $this->image;
  110.     }
  111.     public function setImage($image): self
  112.     {
  113.         $this->image $image;
  114.         return $this;
  115.     }
  116.     public function getSlug(): ?string
  117.     {
  118.         return $this->slug;
  119.     }
  120.     public function setSlug(string $slug): self
  121.     {
  122.         $this->slug $slug;
  123.         return $this;
  124.     }
  125.     public function getBlogCategory(): ?BlogCategory
  126.     {
  127.         return $this->blogCategory;
  128.     }
  129.     public function setBlogCategory(?BlogCategory $blogCategory): self
  130.     {
  131.         $this->blogCategory $blogCategory;
  132.         return $this;
  133.     }
  134. }