src/Entity/Article.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\ArticleRepository;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. #[ORM\Entity(repositoryClassArticleRepository::class)]
  10. class Article
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $title;
  18.     #[ORM\Column(type'text'nullabletrue)]
  19.     private $description;
  20.     #[ORM\ManyToOne(targetEntityAdmin::class, inversedBy'articles')]
  21.     #[ORM\JoinColumn(nullabletrue)]
  22.     private $author;
  23.     #[ORM\Column(type'datetime')]
  24.     private $createdDate;
  25.     #[ORM\Column(type'string'length255nullabletrue)]
  26.     private $slug;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     private $cover;
  29.     #[ORM\Column(type'string'length255nullabletrue)]
  30.     private $views;
  31.     #[ORM\ManyToMany(targetEntityCategory::class, mappedBy'articles')]
  32.     private $categories;
  33.     #[ORM\Column(type'boolean')]
  34.     private $published;
  35.     #[ORM\OneToMany(targetEntityComment::class, mappedBy'article'cascade: ['persist''remove'])]
  36.     private $comments;
  37.     #[ORM\Column(type'string'length255)]
  38.     private $status;
  39.     #[ORM\ManyToOne(targetEntityAdmin::class, inversedBy'reviewedArticles')]
  40.     private $reviewer;
  41.     #[ORM\Column(type'boolean'nullabletrue)]
  42.     private $featured;
  43.     #[ORM\Column(type'datetime'nullabletrue)]
  44.     private $featuredAt;
  45.     #[ORM\ManyToOne(targetEntityWebsiteLanguage::class, inversedBy'articles')]
  46.     private $websiteLanguage;
  47.     #[ORM\Column(type'boolean')]
  48.     private $original;
  49.     #[ORM\Column(type'integer'nullabletrue)]
  50.     private $unit;
  51.     #[ORM\Column(type'string'length255nullabletrue)]
  52.     private $altCover;
  53.     #[ORM\Column(type'string'length255nullabletrue)]
  54.     private $titleSeo;
  55.     #[ORM\Column(type'text'nullabletrue)]
  56.     private $descriptionSeo;
  57.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  58.     private ?\DateTimeInterface $publishedAt null;
  59.     public function __construct()
  60.     {
  61.         $this->createdDate = new DateTime();
  62.         $this->categories = new ArrayCollection();
  63.         $this->comments = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getTitle(): ?string
  70.     {
  71.         return $this->title;
  72.     }
  73.     public function setTitle(?string $title): self
  74.     {
  75.         $this->title $title;
  76.         return $this;
  77.     }
  78.     public function getDescription(): ?string
  79.     {
  80.         return $this->description;
  81.     }
  82.     public function setDescription(?string $description): self
  83.     {
  84.         $this->description $description;
  85.         return $this;
  86.     }
  87.     public function getAuthor(): ?Admin
  88.     {
  89.         return $this->author;
  90.     }
  91.     public function setAuthor(?Admin $author): self
  92.     {
  93.         $this->author $author;
  94.         return $this;
  95.     }
  96.     public function getCreatedDate(): ?\DateTimeInterface
  97.     {
  98.         return $this->createdDate;
  99.     }
  100.     public function setCreatedDate(\DateTimeInterface $createdDate): self
  101.     {
  102.         $this->createdDate $createdDate;
  103.         return $this;
  104.     }
  105.     public function getSlug(): ?string
  106.     {
  107.         return $this->slug;
  108.     }
  109.     public function setSlug(?string $slug): self
  110.     {
  111.         $this->slug $slug;
  112.         return $this;
  113.     }
  114.     public function getCover()
  115.     {
  116.         return $this->cover;
  117.     }
  118.     public function setCover($cover): self
  119.     {
  120.         $this->cover $cover;
  121.         return $this;
  122.     }
  123.     public function getViews(): ?string
  124.     {
  125.         return $this->views;
  126.     }
  127.     public function setViews(?string $views): self
  128.     {
  129.         $this->views $views;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection|Category[]
  134.      */
  135.     public function getCategories(): Collection
  136.     {
  137.         return $this->categories;
  138.     }
  139.     public function addCategory(Category $category): self
  140.     {
  141.         if (!$this->categories->contains($category)) {
  142.             $this->categories[] = $category;
  143.             $category->addArticle($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeCategory(Category $category): self
  148.     {
  149.         if ($this->categories->removeElement($category)) {
  150.             $category->removeArticle($this);
  151.         }
  152.         return $this;
  153.     }
  154.     public function getPublished(): ?bool
  155.     {
  156.         return $this->published;
  157.     }
  158.     public function setPublished(bool $published): self
  159.     {
  160.         $this->published $published;
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection|Comment[]
  165.      */
  166.     public function getComments(): Collection
  167.     {
  168.         return $this->comments;
  169.     }
  170.     public function addComment(Comment $comment): self
  171.     {
  172.         if (!$this->comments->contains($comment)) {
  173.             $this->comments[] = $comment;
  174.             $comment->setArticle($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeComment(Comment $comment): self
  179.     {
  180.         if ($this->comments->removeElement($comment)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($comment->getArticle() === $this) {
  183.                 $comment->setArticle(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     public function getStatus(): ?string
  189.     {
  190.         return $this->status;
  191.     }
  192.     public function setStatus(string $status): self
  193.     {
  194.         $this->status $status;
  195.         return $this;
  196.     }
  197.     public function getReviewer(): ?Admin
  198.     {
  199.         return $this->reviewer;
  200.     }
  201.     public function setReviewer(?Admin $reviewer): self
  202.     {
  203.         $this->reviewer $reviewer;
  204.         return $this;
  205.     }
  206.     public function getFeatured(): ?bool
  207.     {
  208.         return $this->featured;
  209.     }
  210.     public function setFeatured(?bool $featured): self
  211.     {
  212.         $this->featured $featured;
  213.         return $this;
  214.     }
  215.     public function getFeaturedAt(): ?\DateTimeInterface
  216.     {
  217.         return $this->featuredAt;
  218.     }
  219.     public function setFeaturedAt(?\DateTimeInterface $featuredAt): self
  220.     {
  221.         $this->featuredAt $featuredAt;
  222.         return $this;
  223.     }
  224.     public function getWebsiteLanguage(): ?WebsiteLanguage
  225.     {
  226.         return $this->websiteLanguage;
  227.     }
  228.     public function setWebsiteLanguage(?WebsiteLanguage $websiteLanguage): self
  229.     {
  230.         $this->websiteLanguage $websiteLanguage;
  231.         return $this;
  232.     }
  233.     public function getOriginal(): ?bool
  234.     {
  235.         return $this->original;
  236.     }
  237.     public function setOriginal(bool $original): self
  238.     {
  239.         $this->original $original;
  240.         return $this;
  241.     }
  242.     public function getUnit(): ?int
  243.     {
  244.         return $this->unit;
  245.     }
  246.     public function setUnit(int $unit): self
  247.     {
  248.         $this->unit $unit;
  249.         return $this;
  250.     }
  251.     public function getAltCover(): ?string
  252.     {
  253.         return $this->altCover;
  254.     }
  255.     public function setAltCover(?string $altCover): self
  256.     {
  257.         $this->altCover $altCover;
  258.         return $this;
  259.     }
  260.     public function getTitleSeo(): ?string
  261.     {
  262.         return $this->titleSeo;
  263.     }
  264.     public function setTitleSeo(?string $titleSeo): self
  265.     {
  266.         $this->titleSeo $titleSeo;
  267.         return $this;
  268.     }
  269.     public function getDescriptionSeo(): ?string
  270.     {
  271.         return $this->descriptionSeo;
  272.     }
  273.     public function setDescriptionSeo(?string $descriptionSeo): self
  274.     {
  275.         $this->descriptionSeo $descriptionSeo;
  276.         return $this;
  277.     }
  278.     public function getPublishedAt(): ?\DateTimeInterface
  279.     {
  280.         return $this->publishedAt;
  281.     }
  282.     public function setPublishedAt(?\DateTimeInterface $publishedAt): static
  283.     {
  284.         $this->publishedAt $publishedAt;
  285.         return $this;
  286.     }
  287. }