src/Entity/Article.php line 12
<?php
namespace App\Entity;
use App\Repository\ArticleRepository;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ArticleRepository::class)]
class Article
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $title;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $titleTag;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $keywords;
#[ORM\Column(type: 'text', nullable: true)]
private $metaDescription;
#[ORM\Column(type: 'text', nullable: true)]
private $text;
#[ORM\Column(type: 'datetime', nullable: true)]
private $created;
#[ORM\Column(type: 'datetime', nullable: true)]
private $published;
#[ORM\Column(type: 'datetime', nullable: true)]
private $modified;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $image;
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'articles')]
private $category;
#[ORM\OneToMany(mappedBy: 'article', targetEntity: Paragraph::class)]
private $paragraphs;
#[ORM\ManyToOne(targetEntity: Gallery::class, inversedBy: 'articles')]
private $gallery;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $slug;
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'articles')]
private $tag;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $author;
#[ORM\OneToMany(mappedBy: 'article', targetEntity: ArticleTranslation::class)]
private Collection $articleTranslations;
public function __construct(){
$this->created = new DateTime();
$this->paragraphs = new ArrayCollection();
$this->tag = new ArrayCollection();
$this->articleTranslations = new ArrayCollection();
}
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 getTitleTag(): ?string
{
return $this->titleTag;
}
public function setTitleTag(?string $titleTag): self
{
$this->titleTag = $titleTag;
return $this;
}
public function getKeywords(): ?string
{
return $this->keywords;
}
public function setKeywords(?string $keywords): self
{
$this->keywords = $keywords;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(?\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getPublished(): ?\DateTimeInterface
{
return $this->published;
}
public function setPublished(?\DateTimeInterface $published): self
{
$this->published = $published;
return $this;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(?\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
/**
* @return Collection<int, Paragraph>
*/
public function getParagraphs(): Collection
{
return $this->paragraphs;
}
public function addParagraph(Paragraph $paragraph): self
{
if (!$this->paragraphs->contains($paragraph)) {
$this->paragraphs[] = $paragraph;
$paragraph->setArticle($this);
}
return $this;
}
public function removeParagraph(Paragraph $paragraph): self
{
if ($this->paragraphs->removeElement($paragraph)) {
// set the owning side to null (unless already changed)
if ($paragraph->getArticle() === $this) {
$paragraph->setArticle(null);
}
}
return $this;
}
public function getGallery(): ?Gallery
{
return $this->gallery;
}
public function setGallery(?Gallery $gallery): self
{
$this->gallery = $gallery;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Tag>
*/
public function getTag(): Collection
{
return $this->tag;
}
public function addTag(Tag $tag): self
{
if (!$this->tag->contains($tag)) {
$this->tag[] = $tag;
}
return $this;
}
public function removeTag(Tag $tag): self
{
$this->tag->removeElement($tag);
return $this;
}
public function getAuthor(): ?string
{
return $this->author;
}
public function setAuthor(?string $author): self
{
$this->author = $author;
return $this;
}
/**
* @return Collection<int, ArticleTranslation>
*/
public function getArticleTranslations(): Collection
{
return $this->articleTranslations;
}
public function addArticleTranslation(ArticleTranslation $articleTranslation): self
{
if (!$this->articleTranslations->contains($articleTranslation)) {
$this->articleTranslations->add($articleTranslation);
$articleTranslation->setArticle($this);
}
return $this;
}
public function removeArticleTranslation(ArticleTranslation $articleTranslation): self
{
if ($this->articleTranslations->removeElement($articleTranslation)) {
// set the owning side to null (unless already changed)
if ($articleTranslation->getArticle() === $this) {
$articleTranslation->setArticle(null);
}
}
return $this;
}
}