src/Entity/Article.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
  8.  *
  9.  * @ORM\HasLifecycleCallbacks()
  10.  *
  11.  * @ORM\Table(indexes={
  12.  *
  13.  *     @ORM\Index(name="article_deleted_idx", columns={"deleted_at"}),
  14.  *     @ORM\Index(name="publication_start_idx", columns={"publication_start"}),
  15.  *     @ORM\Index(name="publication_end_idx", columns={"publication_end"}),
  16.  *     @ORM\Index(name="highlight_start_idx", columns={"highlight_start"}),
  17.  *     @ORM\Index(name="highlight_end_idx", columns={"highlight_end"}),
  18.  *     @ORM\Index(name="slug_idx", columns={"slug"})
  19.  * })
  20.  */
  21. class Article
  22. {
  23.     public const PUBLICATION_STATUS_DRAFT 0;
  24.     public const PUBLICATION_STATUS_PUBLISHED 1;
  25.     public const HIGHLIGHT_STATUS_OFF 0;
  26.     public const HIGHLIGHT_STATUS_ON 1;
  27.     public const SCOOPS_ON 1;
  28.     public function __construct()
  29.     {
  30.         $this->article_blocks = new ArrayCollection();
  31.         $this->newsletter_articles = new ArrayCollection();
  32.         $this->article_tags = new ArrayCollection();
  33.         $this->comments = new ArrayCollection();
  34.         $this->articleCategories = new ArrayCollection();
  35.         $this->views = new ArrayCollection();
  36.         $this->newsletter_highlights = new ArrayCollection();
  37.         $this->article_products = new ArrayCollection();
  38.         $this->articles_favorite = new ArrayCollection();
  39.     }
  40.     /**
  41.      * @ORM\Id()
  42.      *
  43.      * @ORM\GeneratedValue()
  44.      *
  45.      * @ORM\Column(type="integer")
  46.      */
  47.     private $id;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleFavoris", mappedBy="article", cascade={"persist", "remove"})
  50.      */
  51.     private $articles_favorite;
  52.     /**
  53.      * @ORM\Column(type="string", nullable=true, length=180)
  54.      */
  55.     private $author_email null;
  56.     /**
  57.      * @ORM\Column(type="datetime", nullable=true)
  58.      */
  59.     private $publication_start null;
  60.     /**
  61.      * @ORM\Column(type="string", nullable=true, length=180)
  62.      */
  63.     private $slug null;
  64.     /**
  65.      * @ORM\Column(type="string", nullable=true, length=180)
  66.      */
  67.     private $author_name null;
  68.     /**
  69.      * @ORM\Column(type="text",nullable=false)
  70.      */
  71.     private $title null;
  72.     /**
  73.      * @ORM\Column(type="datetime", nullable=true)
  74.      */
  75.     private $publication_end null;
  76.     /**
  77.      * @ORM\Column(type="datetime", nullable=true)
  78.      */
  79.     private $highlight_start null;
  80.     /**
  81.      * @ORM\Column(type="datetime", nullable=true)
  82.      */
  83.     private $highlight_end null;
  84.     /**
  85.      * @ORM\Column(type="text", nullable=true)
  86.      */
  87.     private $hat null;
  88.     /**
  89.      * @ORM\Column(type="text", nullable=true)
  90.      */
  91.     private $summary null;
  92.     /**
  93.      * @ORM\Column(type="integer", nullable=false)
  94.      */
  95.     private $publication_status 0;
  96.     /**
  97.      * @ORM\Column(type="integer", nullable=false)
  98.      */
  99.     private $highlight_status 0;
  100.     /**
  101.      * @ORM\Column(type="integer", nullable=true)
  102.      */
  103.     private $legacy_id null;
  104.     /**
  105.      * @ORM\Column(type="string", nullable=true, length=180)
  106.      */
  107.     private $source_platform_name null;
  108.     /**
  109.      * @ORM\Column(type="string", nullable=true, length=180)
  110.      */
  111.     private $source_platform_uid null;
  112.     /**
  113.      * @ORM\Column(type="integer", nullable=true, length=180)
  114.      */
  115.     private $source_article_id null;
  116.     /**
  117.      * @ORM\Column(type="integer", nullable=false,  options={"default": 0})
  118.      */
  119.     private $subscribers_only 0;
  120.     /**
  121.      * @ORM\Column(type="integer", nullable=false,  options={"default": 0})
  122.      */
  123.     private $scoop 0;
  124.     /**
  125.      * @ORM\Column(type="text", nullable=true)
  126.      */
  127.     private $marketplace_tags;
  128.     /**
  129.      * @ORM\Column(type="string", nullable=true)
  130.      */
  131.     private $e_shop_url_product;
  132.     /**
  133.      * @ORM\Column(type="string", nullable=true)
  134.      */
  135.     private $e_shop_url_product_sub;
  136.     /**
  137.      * @ORM\Column(type="datetime", nullable=true)
  138.      */
  139.     private $free_period_end;
  140.     /**
  141.      * @ORM\Column(type="string", length=255, nullable=true, unique=true)
  142.      */
  143.     private $rss_uuid;
  144.     /**
  145.      * @ORM\Column(type="text", nullable=true)
  146.      */
  147.     private $rss_original_link null;
  148.     /**
  149.      * @ORM\Column(type="boolean", nullable=true)
  150.      */
  151.     private $iscontribution false;
  152.     /**
  153.      * @ORM\Column(type="boolean", nullable=true)
  154.      */
  155.     private $publishAsExpert false;
  156.     /**
  157.      * @ORM\Column(type="boolean", nullable=true)
  158.      */
  159.     private $publishAsAdmin false;
  160.     /**
  161.      * @ORM\Column(type="boolean", nullable=false)
  162.      */
  163.     private $imported false;
  164.     /**
  165.      * @return bool
  166.      */
  167.     public function isIscontribution(): ?bool
  168.     {
  169.         return $this->iscontribution;
  170.     }
  171.     public function setIscontribution(bool $iscontribution): void
  172.     {
  173.         $this->iscontribution $iscontribution;
  174.     }
  175.     public function getId(): ?int
  176.     {
  177.         return $this->id;
  178.     }
  179.     public function getAuthorEmail()
  180.     {
  181.         return $this->author_email;
  182.     }
  183.     public function setAuthorEmail($author_email)
  184.     {
  185.         $this->author_email $author_email;
  186.         return $this;
  187.     }
  188.     public function getPublicationStart()
  189.     {
  190.         return $this->publication_start;
  191.     }
  192.     public function setPublicationStart($publication_start)
  193.     {
  194.         $this->publication_start $publication_start;
  195.         return $this;
  196.     }
  197.     public function getSlug()
  198.     {
  199.         return $this->slug;
  200.     }
  201.     public function setSlug($slug)
  202.     {
  203.         $this->slug $slug;
  204.         return $this;
  205.     }
  206.     public function getLegacyId()
  207.     {
  208.         return $this->legacy_id;
  209.     }
  210.     public function setLegacyId($legacy_id)
  211.     {
  212.         $this->legacy_id $legacy_id;
  213.         return $this;
  214.     }
  215.     public function getAuthorName()
  216.     {
  217.         return $this->author_name;
  218.     }
  219.     public function setAuthorName($author_name)
  220.     {
  221.         $this->author_name $author_name;
  222.         return $this;
  223.     }
  224.     public function getTitle()
  225.     {
  226.         return $this->title;
  227.     }
  228.     public function setTitle($title)
  229.     {
  230.         $this->title $title;
  231.         return $this;
  232.     }
  233.     public function getPublicationEnd()
  234.     {
  235.         return $this->publication_end;
  236.     }
  237.     public function setPublicationEnd($publication_end)
  238.     {
  239.         $this->publication_end $publication_end;
  240.         return $this;
  241.     }
  242.     public function getHighlightStart()
  243.     {
  244.         return $this->highlight_start;
  245.     }
  246.     public function setHighlightStart($highlight_start)
  247.     {
  248.         $this->highlight_start $highlight_start;
  249.         return $this;
  250.     }
  251.     public function getHighlightEnd()
  252.     {
  253.         return $this->highlight_end;
  254.     }
  255.     public function setHighlightEnd($highlight_end)
  256.     {
  257.         $this->highlight_end $highlight_end;
  258.         return $this;
  259.     }
  260.     public function getHat()
  261.     {
  262.         return $this->hat;
  263.     }
  264.     public function setHat($hat)
  265.     {
  266.         $this->hat $hat;
  267.         return $this;
  268.     }
  269.     public function getSummary()
  270.     {
  271.         return $this->summary;
  272.     }
  273.     public function setSummary($summary)
  274.     {
  275.         $this->summary $summary;
  276.         return $this;
  277.     }
  278.     public function getPublicationStatus()
  279.     {
  280.         return $this->publication_status;
  281.     }
  282.     public function setPublicationStatus($publication_status)
  283.     {
  284.         $this->publication_status $publication_status;
  285.         return $this;
  286.     }
  287.     public function getHighlightStatus()
  288.     {
  289.         return $this->highlight_status;
  290.     }
  291.     public function setHighlightStatus($highlight_status)
  292.     {
  293.         $this->highlight_status $highlight_status;
  294.         return $this;
  295.     }
  296.     public function getSourcePlatformUid()
  297.     {
  298.         return $this->source_platform_uid;
  299.     }
  300.     public function setSourcePlatformUid($source_platform_uid)
  301.     {
  302.         $this->source_platform_uid $source_platform_uid;
  303.         return $this;
  304.     }
  305.     public function getSourcePlatformName()
  306.     {
  307.         return $this->source_platform_name;
  308.     }
  309.     public function setSourcePlatformName($source_platform_name)
  310.     {
  311.         $this->source_platform_name $source_platform_name;
  312.         return $this;
  313.     }
  314.     public function getSourceArticleId()
  315.     {
  316.         return $this->source_article_id;
  317.     }
  318.     public function setSourceArticleId($source_article_id)
  319.     {
  320.         $this->source_article_id $source_article_id;
  321.         return $this;
  322.     }
  323.     /**
  324.      * @return int
  325.      */
  326.     public function getSubscribersOnly()
  327.     {
  328.         return $this->subscribers_only;
  329.     }
  330.     public function setSubscribersOnly(int $subscribers_only): self
  331.     {
  332.         $this->subscribers_only $subscribers_only;
  333.         return $this;
  334.     }
  335.     /**
  336.      * @return int
  337.      */
  338.     public function getScoop()
  339.     {
  340.         return $this->scoop;
  341.     }
  342.     public function setScoop(int $scoop): self
  343.     {
  344.         $this->scoop $scoop;
  345.         return $this;
  346.     }
  347.     /**
  348.      * @return mixed
  349.      */
  350.     public function getMarketplaceTags()
  351.     {
  352.         return $this->marketplace_tags;
  353.     }
  354.     /**
  355.      * @param mixed $marketplace_tags
  356.      *
  357.      * @return Article
  358.      */
  359.     public function setMarketplaceTags($marketplace_tags)
  360.     {
  361.         $this->marketplace_tags $marketplace_tags;
  362.         return $this;
  363.     }
  364.     /**
  365.      * @return mixed
  366.      */
  367.     public function getEshopUrlProduct()
  368.     {
  369.         return $this->e_shop_url_product;
  370.     }
  371.     /**
  372.      * @param mixed $e_shop_url_product
  373.      *
  374.      * @return Article
  375.      */
  376.     public function setEshopUrlProduct($e_shop_url_product)
  377.     {
  378.         $this->e_shop_url_product $e_shop_url_product;
  379.         return $this;
  380.     }
  381.     /**
  382.      * @return mixed
  383.      */
  384.     public function getEShopUrlProductSub()
  385.     {
  386.         return $this->e_shop_url_product_sub;
  387.     }
  388.     /**
  389.      * @param mixed $e_shop_url_product_sub
  390.      *
  391.      * @return Article
  392.      */
  393.     public function setEShopUrlProductSub($e_shop_url_product_sub)
  394.     {
  395.         $this->e_shop_url_product_sub $e_shop_url_product_sub;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @ORM\Column(type="datetime", nullable=false)
  400.      */
  401.     private $created_at;
  402.     /**
  403.      * @ORM\Column(type="datetime", nullable=true)
  404.      */
  405.     private $updated_at null;
  406.     public function getCreatedAt(): \DateTimeInterface
  407.     {
  408.         return $this->created_at;
  409.     }
  410.     public function setCreatedAt(\DateTimeInterface $created_at): self
  411.     {
  412.         $this->created_at $created_at;
  413.         return $this;
  414.     }
  415.     public function getUpdatedAt(): ?\DateTimeInterface
  416.     {
  417.         return $this->updated_at;
  418.     }
  419.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  420.     {
  421.         $this->updated_at $updated_at;
  422.         return $this;
  423.     }
  424.     /**
  425.      * @ORM\PrePersist
  426.      */
  427.     public function setCreatedAtValue()
  428.     {
  429.         $this->setCreatedAt(new \DateTime());
  430.     }
  431.     /**
  432.      * @ORM\PreUpdate
  433.      */
  434.     public function setUpdatedAtValue()
  435.     {
  436.         $this->setUpdatedAt(new \DateTime());
  437.     }
  438.     /**
  439.      * @ORM\Column(type="datetime", nullable=true)
  440.      */
  441.     private $deleted_at;
  442.     public function getDeletedAt(): ?\DateTimeInterface
  443.     {
  444.         return $this->deleted_at;
  445.     }
  446.     public function setDeletedAt(?\DateTimeInterface $deleted_at): self
  447.     {
  448.         $this->deleted_at $deleted_at;
  449.         return $this;
  450.     }
  451.     /**
  452.      * @return null
  453.      */
  454.     public function getFreePeriodEnd()
  455.     {
  456.         return $this->free_period_end;
  457.     }
  458.     /**
  459.      * @param null $free_period_end
  460.      *
  461.      * @return Article
  462.      */
  463.     public function setFreePeriodEnd($free_period_end)
  464.     {
  465.         $this->free_period_end $free_period_end;
  466.         return $this;
  467.     }
  468.     /**
  469.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleBlock", mappedBy="article")
  470.      */
  471.     private $article_blocks;
  472.     /**
  473.      * @return Collection|ArticleBlock[]
  474.      */
  475.     public function getArticleBlocks(): Collection
  476.     {
  477.         return $this->article_blocks;
  478.     }
  479.     public function addArticleBlock(ArticleBlock $article_block): self
  480.     {
  481.         if (!$this->article_blocks->contains($article_block)) {
  482.             $this->article_blocks[] = $article_block;
  483.             $article_block->setArticle($this);
  484.         }
  485.         return $this;
  486.     }
  487.     public function removeArticleBlock(ArticleBlock $article_block): self
  488.     {
  489.         if ($this->article_blocks->contains($article_block)) {
  490.             $this->article_blocks->removeElement($article_block);
  491.             if ($article_block->getArticle() === $this) {
  492.                 $article_block->setArticle(null);
  493.             }
  494.         }
  495.         return $this;
  496.     }
  497.     /**
  498.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleProduct", mappedBy="article")
  499.      */
  500.     private $article_products;
  501.     /**
  502.      * @return Collection|ArticleProduct[]
  503.      */
  504.     public function getArticleProducts(): Collection
  505.     {
  506.         return $this->article_products;
  507.     }
  508.     public function addArticleProduct(ArticleProduct $article_product): self
  509.     {
  510.         if (!$this->article_products->contains($article_product)) {
  511.             $this->article_products[] = $article_product;
  512.             $article_product->setArticle($this);
  513.         }
  514.         return $this;
  515.     }
  516.     public function removeArticleProduct(ArticleProduct $article_product): self
  517.     {
  518.         if ($this->article_products->contains($article_product)) {
  519.             $this->article_products->removeElement($article_product);
  520.             if ($article_product->getArticle() === $this) {
  521.                 $article_product->setArticle(null);
  522.             }
  523.         }
  524.         return $this;
  525.     }
  526.     /**
  527.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="articles")
  528.      */
  529.     private $user;
  530.     public function getUser(): ?User
  531.     {
  532.         return $this->user;
  533.     }
  534.     public function setUser(?User $user): self
  535.     {
  536.         $this->user $user;
  537.         return $this;
  538.     }
  539.     /**
  540.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleTag", mappedBy="article")
  541.      */
  542.     private $article_tags;
  543.     /**
  544.      * @return Collection|ArticleTag[]
  545.      */
  546.     public function getArticleTags(): Collection
  547.     {
  548.         return $this->article_tags;
  549.     }
  550.     public function addArticleTag(ArticleTag $article_tag): self
  551.     {
  552.         if (!$this->article_tags->contains($article_tag)) {
  553.             $this->article_tags[] = $article_tag;
  554.             $article_tag->setArticle($this);
  555.         }
  556.         return $this;
  557.     }
  558.     public function removeArticleTag(ArticleTag $article_tag): self
  559.     {
  560.         if ($this->article_tags->contains($article_tag)) {
  561.             $this->article_tags->removeElement($article_tag);
  562.             if ($article_tag->getArticle() === $this) {
  563.                 $article_tag->setArticle(null);
  564.             }
  565.         }
  566.         return $this;
  567.     }
  568.     /**
  569.      * @ORM\ManyToOne(targetEntity="App\Entity\Media")
  570.      *
  571.      * @ORM\JoinColumn(nullable=true)
  572.      */
  573.     private $cover;
  574.     /**
  575.      * @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="article")
  576.      */
  577.     private $comments;
  578.     /**
  579.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleCategory", mappedBy="article")
  580.      */
  581.     private $articleCategories;
  582.     /**
  583.      * @ORM\OneToMany(targetEntity="App\Entity\ArticleView", mappedBy="article")
  584.      */
  585.     private $views;
  586.     public function getCover(): ?Media
  587.     {
  588.         return $this->cover;
  589.     }
  590.     public function setCover(?Media $cover): self
  591.     {
  592.         $this->cover $cover;
  593.         return $this;
  594.     }
  595.     /**
  596.      * @return Collection|Comment[]
  597.      */
  598.     public function getComments(): Collection
  599.     {
  600.         return $this->comments;
  601.     }
  602.     public function getPublishedComments(): array
  603.     {
  604.         $publishedComments = [];
  605.         $comments $this->getComments();
  606.         if ($comments) {
  607.             foreach ($comments as $comment) {
  608.                 if ($comment->getParent()) {
  609.                     $parentDeleted $comment->getParent()->getDeletedAt();
  610.                     if (!$comment->getDeletedAt() && !$parentDeleted) {
  611.                         $publishedComments[] = $comment;
  612.                     }
  613.                 } else {
  614.                     if (!$comment->getDeletedAt()) {
  615.                         $publishedComments[] = $comment;
  616.                     }
  617.                 }
  618.             }
  619.         }
  620.         return $publishedComments;
  621.     }
  622.     public function addComment(Comment $comment): self
  623.     {
  624.         if (!$this->comments->contains($comment)) {
  625.             $this->comments[] = $comment;
  626.             $comment->setArticle($this);
  627.         }
  628.         return $this;
  629.     }
  630.     public function removeComment(Comment $comment): self
  631.     {
  632.         if ($this->comments->contains($comment)) {
  633.             $this->comments->removeElement($comment);
  634.             // set the owning side to null (unless already changed)
  635.             if ($comment->getArticle() === $this) {
  636.                 $comment->setArticle(null);
  637.             }
  638.         }
  639.         return $this;
  640.     }
  641.     /**
  642.      * @return Collection|ArticleCategory[]
  643.      */
  644.     public function getArticleCategories(): Collection
  645.     {
  646.         return $this->articleCategories;
  647.     }
  648.     public function addArticleCategory(ArticleCategory $articleCategory): self
  649.     {
  650.         if (!$this->articleCategories->contains($articleCategory)) {
  651.             $this->articleCategories[] = $articleCategory;
  652.             $articleCategory->setArticle($this);
  653.         }
  654.         return $this;
  655.     }
  656.     public function removeArticleCategory(ArticleCategory $articleCategory): self
  657.     {
  658.         if ($this->articleCategories->contains($articleCategory)) {
  659.             $this->articleCategories->removeElement($articleCategory);
  660.             // set the owning side to null (unless already changed)
  661.             if ($articleCategory->getArticle() === $this) {
  662.                 $articleCategory->setArticle(null);
  663.             }
  664.         }
  665.         return $this;
  666.     }
  667.     /**
  668.      * @ORM\OneToMany(targetEntity="App\Entity\NewsletterArticle", mappedBy="article")
  669.      */
  670.     private $newsletter_articles;
  671.     /**
  672.      * @return Collection|NewsletterArticle[]
  673.      */
  674.     public function getNewsletterArticles(): Collection
  675.     {
  676.         return $this->newsletter_articles;
  677.     }
  678.     public function addNewsletterArticle(NewsletterArticle $newsletter_article): self
  679.     {
  680.         if (!$this->newsletter_articles->contains($newsletter_article)) {
  681.             $this->newsletter_articles[] = $newsletter_article;
  682.             $newsletter_article->setArticle($this);
  683.         }
  684.         return $this;
  685.     }
  686.     public function removeNewsletterArticle(NewsletterArticle $newsletter_article): self
  687.     {
  688.         if ($this->newsletter_articles->contains($newsletter_article)) {
  689.             $this->newsletter_articles->removeElement($newsletter_article);
  690.             if ($newsletter_article->getArticle() === $this) {
  691.                 $newsletter_article->setArticle(null);
  692.             }
  693.         }
  694.         return $this;
  695.     }
  696.     /**
  697.      * @ORM\OneToMany(targetEntity="App\Entity\Newsletter", mappedBy="highlighted_article")
  698.      */
  699.     private $newsletter_highlights;
  700.     /**
  701.      * @ORM\Column(type="json", nullable=true)
  702.      */
  703.     private $rss_data = [];
  704.     /**
  705.      * @ORM\ManyToOne(targetEntity=RssFeed::class, inversedBy="articles")
  706.      */
  707.     private $rss_feed;
  708.     /**
  709.      * @return Collection|Newsletter[]
  710.      */
  711.     public function getNewsletterHighlights(): Collection
  712.     {
  713.         return $this->newsletter_highlights;
  714.     }
  715.     public function addNewsletterHighlight(Newsletter $newsletter_highlight): self
  716.     {
  717.         if (!$this->newsletter_highlights->contains($newsletter_highlight)) {
  718.             $this->newsletter_highlights[] = $newsletter_highlight;
  719.             $newsletter_highlight->setHighlightedArticle($this);
  720.         }
  721.         return $this;
  722.     }
  723.     public function removeNewsletterHighlight(Newsletter $newsletter_highlight): self
  724.     {
  725.         if ($this->newsletter_highlights->contains($newsletter_highlight)) {
  726.             $this->newsletter_highlights->removeElement($newsletter_highlight);
  727.             if ($newsletter_highlight->getHighlightedArticle() === $this) {
  728.                 $newsletter_highlight->setHighlightedArticle(null);
  729.             }
  730.         }
  731.         return $this;
  732.     }
  733.     /**
  734.      * @return mixed
  735.      */
  736.     public function getViews()
  737.     {
  738.         return $this->views;
  739.     }
  740.     /**
  741.      * @param mixed $views
  742.      *
  743.      * @return Article
  744.      */
  745.     public function setViews($views)
  746.     {
  747.         $this->views $views;
  748.         return $this;
  749.     }
  750.     // Custom methods
  751.     public function isPremium(): bool
  752.     {
  753.         // Legacy
  754.         if ($this->subscribers_only && $this->publication_start instanceof \DateTime && !$this->free_period_end) {
  755.             $this->free_period_end = (clone $this->publication_start)->modify('+7 days');
  756.         }
  757.         // Keep only this condition in the future, $this->subscribers_only will become useless
  758.         if ($this->free_period_end && $this->free_period_end < new \DateTime()) {
  759.             return true;
  760.         }
  761.         return false;
  762.     }
  763.     /**
  764.      * @return mixed
  765.      */
  766.     public function getRssUuid()
  767.     {
  768.         return $this->rss_uuid;
  769.     }
  770.     /**
  771.      * @param mixed $rss_uuid
  772.      *
  773.      * @return Article
  774.      */
  775.     public function setRssUuid($rss_uuid)
  776.     {
  777.         $this->rss_uuid $rss_uuid;
  778.         return $this;
  779.     }
  780.     public function getRssData(): ?array
  781.     {
  782.         return $this->rss_data;
  783.     }
  784.     public function setRssData(?array $rssdata): self
  785.     {
  786.         $this->rss_data $rssdata;
  787.         return $this;
  788.     }
  789.     public function getRssFeed(): ?RssFeed
  790.     {
  791.         return $this->rss_feed;
  792.     }
  793.     public function setRssFeed(?RssFeed $rss_feed): self
  794.     {
  795.         $this->rss_feed $rss_feed;
  796.         return $this;
  797.     }
  798.     public function getRssOriginalLink(): ?string
  799.     {
  800.         return $this->rss_original_link;
  801.     }
  802.     public function setRssOriginalLink(string $rss_original_link): self
  803.     {
  804.         $this->rss_original_link $rss_original_link;
  805.         return $this;
  806.     }
  807.     /**
  808.      * @return bool
  809.      */
  810.     public function isPublishAsExpert(): ?bool
  811.     {
  812.         return $this->publishAsExpert;
  813.     }
  814.     /**
  815.      * @param bool $publishAsExpert
  816.      */
  817.     public function setPublishAsExpert(?bool $publishAsExpert)
  818.     {
  819.         $this->publishAsExpert $publishAsExpert;
  820.     }
  821.     /**
  822.      * @return bool
  823.      */
  824.     public function isPublishAsAdmin(): ?bool
  825.     {
  826.         return $this->publishAsAdmin;
  827.     }
  828.     /**
  829.      * @param bool $publishAsAdmin
  830.      */
  831.     public function setPublishAsAdmin(?bool $publishAsAdmin)
  832.     {
  833.         $this->publishAsAdmin $publishAsAdmin;
  834.     }
  835.     public function isImported(): bool
  836.     {
  837.         return $this->imported;
  838.     }
  839.     public function setImported(bool $imported): void
  840.     {
  841.         $this->imported $imported;
  842.     }
  843.     /**
  844.      * @return void
  845.      *
  846.      * @ORM\PreFlush()
  847.      */
  848.     public function handlePreFlush()
  849.     {
  850.         if ($this->subscribers_only && $this->publication_start instanceof \DateTime && !$this->free_period_end) {
  851.             $this->free_period_end = (clone $this->publication_start)->modify('+7 days');
  852.         }
  853.         if (!$this->subscribers_only) {
  854.             $this->free_period_end null;
  855.         }
  856.     }
  857.     public function getArticleFavorite(): Collection
  858.     {
  859.         return $this->articles_favorite;
  860.     }
  861. }