<?php
namespace App\Entity;
use App\Repository\ArticleRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ArticleRepository::class)
*/
class Article
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(message="Veuillez renseigner le titre de l'article")
*/
private $title;
/**
* @ORM\Column(type="text")
*
* @Assert\NotBlank(message="Veuillez ajouter du contenu à l'article")
*/
private $text;
/**
* @ORM\Column(type="datetime")
*/
private $publishedAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $metaTitle;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $metaDescription;
/**
* @ORM\Column(type="string", length=255)
*
*/
private $image;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\ManyToOne(targetEntity=BlogCategory::class, inversedBy="articles")
*/
private $blogCategory;
public function __construct()
{
$this->publishedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(string $text): self
{
$this->text = $text;
return $this;
}
public function getPublishedAt(): ?\DateTimeInterface
{
return $this->publishedAt;
}
public function setPublishedAt(\DateTimeInterface $publishedAt): self
{
$this->publishedAt = $publishedAt;
return $this;
}
public function getMetaTitle(): ?string
{
return $this->metaTitle;
}
public function setMetaTitle(?string $metaTitle): self
{
$this->metaTitle = $metaTitle;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getImage()
{
return $this->image;
}
public function setImage($image): self
{
$this->image = $image;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getBlogCategory(): ?BlogCategory
{
return $this->blogCategory;
}
public function setBlogCategory(?BlogCategory $blogCategory): self
{
$this->blogCategory = $blogCategory;
return $this;
}
}