src/Entity/Article.php line 14

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