src/Entity/Article.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ArticleRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassArticleRepository::class)]
  9. class Article
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private $title;
  17.     #[ORM\Column(type'string'length255nullabletrue)]
  18.     private $titleTag;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $keywords;
  21.     #[ORM\Column(type'text'nullabletrue)]
  22.     private $metaDescription;
  23.     #[ORM\Column(type'text'nullabletrue)]
  24.     private $text;
  25.     #[ORM\Column(type'datetime'nullabletrue)]
  26.     private $created;
  27.     #[ORM\Column(type'datetime'nullabletrue)]
  28.     private $published;
  29.     #[ORM\Column(type'datetime'nullabletrue)]
  30.     private $modified;
  31.     #[ORM\Column(type'boolean'nullabletrue)]
  32.     private $isActive;
  33.     #[ORM\Column(type'string'length255nullabletrue)]
  34.     private $image;
  35.     #[ORM\ManyToOne(targetEntityCategory::class, inversedBy'articles')]
  36.     private $category;
  37.     #[ORM\OneToMany(mappedBy'article'targetEntityParagraph::class)]
  38.     private $paragraphs;
  39.     #[ORM\ManyToOne(targetEntityGallery::class, inversedBy'articles')]
  40.     private $gallery;
  41.     #[ORM\Column(type'string'length255nullabletrue)]
  42.     private $slug;
  43.     #[ORM\ManyToMany(targetEntityTag::class, inversedBy'articles')]
  44.     private $tag;
  45.     #[ORM\Column(type'string'length255nullabletrue)]
  46.     private $author;
  47.     #[ORM\OneToMany(mappedBy'article'targetEntityArticleTranslation::class)]
  48.     private Collection $articleTranslations;
  49.     public function __construct(){
  50.         $this->created = new DateTime();
  51.         $this->paragraphs = new ArrayCollection();
  52.         $this->tag = new ArrayCollection();
  53.         $this->articleTranslations = new ArrayCollection();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getTitle(): ?string
  60.     {
  61.         return $this->title;
  62.     }
  63.     public function setTitle(?string $title): self
  64.     {
  65.         $this->title $title;
  66.         return $this;
  67.     }
  68.     public function getTitleTag(): ?string
  69.     {
  70.         return $this->titleTag;
  71.     }
  72.     public function setTitleTag(?string $titleTag): self
  73.     {
  74.         $this->titleTag $titleTag;
  75.         return $this;
  76.     }
  77.     public function getKeywords(): ?string
  78.     {
  79.         return $this->keywords;
  80.     }
  81.     public function setKeywords(?string $keywords): self
  82.     {
  83.         $this->keywords $keywords;
  84.         return $this;
  85.     }
  86.     public function getMetaDescription(): ?string
  87.     {
  88.         return $this->metaDescription;
  89.     }
  90.     public function setMetaDescription(?string $metaDescription): self
  91.     {
  92.         $this->metaDescription $metaDescription;
  93.         return $this;
  94.     }
  95.     public function getText(): ?string
  96.     {
  97.         return $this->text;
  98.     }
  99.     public function setText(?string $text): self
  100.     {
  101.         $this->text $text;
  102.         return $this;
  103.     }
  104.     public function getCreated(): ?\DateTimeInterface
  105.     {
  106.         return $this->created;
  107.     }
  108.     public function setCreated(?\DateTimeInterface $created): self
  109.     {
  110.         $this->created $created;
  111.         return $this;
  112.     }
  113.     public function getPublished(): ?\DateTimeInterface
  114.     {
  115.         return $this->published;
  116.     }
  117.     public function setPublished(?\DateTimeInterface $published): self
  118.     {
  119.         $this->published $published;
  120.         return $this;
  121.     }
  122.     public function getModified(): ?\DateTimeInterface
  123.     {
  124.         return $this->modified;
  125.     }
  126.     public function setModified(?\DateTimeInterface $modified): self
  127.     {
  128.         $this->modified $modified;
  129.         return $this;
  130.     }
  131.     public function getIsActive(): ?bool
  132.     {
  133.         return $this->isActive;
  134.     }
  135.     public function setIsActive(?bool $isActive): self
  136.     {
  137.         $this->isActive $isActive;
  138.         return $this;
  139.     }
  140.     public function getImage(): ?string
  141.     {
  142.         return $this->image;
  143.     }
  144.     public function setImage(?string $image): self
  145.     {
  146.         $this->image $image;
  147.         return $this;
  148.     }
  149.     public function getCategory(): ?Category
  150.     {
  151.         return $this->category;
  152.     }
  153.     public function setCategory(?Category $category): self
  154.     {
  155.         $this->category $category;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return Collection<int, Paragraph>
  160.      */
  161.     public function getParagraphs(): Collection
  162.     {
  163.         return $this->paragraphs;
  164.     }
  165.     public function addParagraph(Paragraph $paragraph): self
  166.     {
  167.         if (!$this->paragraphs->contains($paragraph)) {
  168.             $this->paragraphs[] = $paragraph;
  169.             $paragraph->setArticle($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeParagraph(Paragraph $paragraph): self
  174.     {
  175.         if ($this->paragraphs->removeElement($paragraph)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($paragraph->getArticle() === $this) {
  178.                 $paragraph->setArticle(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.     public function getGallery(): ?Gallery
  184.     {
  185.         return $this->gallery;
  186.     }
  187.     public function setGallery(?Gallery $gallery): self
  188.     {
  189.         $this->gallery $gallery;
  190.         return $this;
  191.     }
  192.     public function getSlug(): ?string
  193.     {
  194.         return $this->slug;
  195.     }
  196.     public function setSlug(?string $slug): self
  197.     {
  198.         $this->slug $slug;
  199.         return $this;
  200.     }
  201.     /**
  202.      * @return Collection<int, Tag>
  203.      */
  204.     public function getTag(): Collection
  205.     {
  206.         return $this->tag;
  207.     }
  208.     public function addTag(Tag $tag): self
  209.     {
  210.         if (!$this->tag->contains($tag)) {
  211.             $this->tag[] = $tag;
  212.         }
  213.         return $this;
  214.     }
  215.     public function removeTag(Tag $tag): self
  216.     {
  217.         $this->tag->removeElement($tag);
  218.         return $this;
  219.     }
  220.     public function getAuthor(): ?string
  221.     {
  222.         return $this->author;
  223.     }
  224.     public function setAuthor(?string $author): self
  225.     {
  226.         $this->author $author;
  227.         return $this;
  228.     }
  229.     /**
  230.      * @return Collection<int, ArticleTranslation>
  231.      */
  232.     public function getArticleTranslations(): Collection
  233.     {
  234.         return $this->articleTranslations;
  235.     }
  236.     public function addArticleTranslation(ArticleTranslation $articleTranslation): self
  237.     {
  238.         if (!$this->articleTranslations->contains($articleTranslation)) {
  239.             $this->articleTranslations->add($articleTranslation);
  240.             $articleTranslation->setArticle($this);
  241.         }
  242.         return $this;
  243.     }
  244.     public function removeArticleTranslation(ArticleTranslation $articleTranslation): self
  245.     {
  246.         if ($this->articleTranslations->removeElement($articleTranslation)) {
  247.             // set the owning side to null (unless already changed)
  248.             if ($articleTranslation->getArticle() === $this) {
  249.                 $articleTranslation->setArticle(null);
  250.             }
  251.         }
  252.         return $this;
  253.     }
  254. }