src/Entity/RssFeed.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RssFeedRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=RssFeedRepository::class)
  9.  */
  10. class RssFeed
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      *
  15.      * @ORM\GeneratedValue
  16.      *
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private ?int $id;
  20.     /**
  21.      * @ORM\OneToMany(targetEntity="App\Entity\RssFeedCategory", mappedBy="rssFeed")
  22.      */
  23.     private $rssFeedCategories;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=false)
  26.      */
  27.     private $api_path;
  28.     /**
  29.      * @ORM\Column(type="datetime", nullable=true)
  30.      */
  31.     private $last_build_at;
  32.     /**
  33.      * @ORM\OneToMany(targetEntity=Article::class, mappedBy="rss_feed")
  34.      */
  35.     private $articles;
  36.     /**
  37.      * @ORM\Column(type="string", length=255)
  38.      */
  39.     private $last_synced_at;
  40.     /**
  41.      * @ORM\Column(type="string", length=60, nullable=true)
  42.      */
  43.     private $rss_name;
  44.     /**
  45.      * @ORM\Column(type="boolean", options={"default" : 1})
  46.      */
  47.     private $active;
  48.     public function __construct()
  49.     {
  50.         $this->articles = new ArrayCollection();
  51.         $this->rssFeedCategories = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     /**
  58.      * @return mixed
  59.      */
  60.     public function getApiPath()
  61.     {
  62.         return trim($this->api_path);
  63.     }
  64.     /**
  65.      * @param mixed $api_path
  66.      *
  67.      * @return RssFeed
  68.      */
  69.     public function setApiPath($api_path)
  70.     {
  71.         $this->api_path trim($api_path);
  72.         return $this;
  73.     }
  74.     public function getLastBuildAt(): ?\DateTimeInterface
  75.     {
  76.         return $this->last_build_at;
  77.     }
  78.     public function setLastBuildAt(?\DateTimeInterface $last_build_at): self
  79.     {
  80.         $this->last_build_at $last_build_at;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection|Article[]
  85.      */
  86.     public function getArticles(): Collection
  87.     {
  88.         return $this->articles;
  89.     }
  90.     public function addArticle(Article $article): self
  91.     {
  92.         if (!$this->articles->contains($article)) {
  93.             $this->articles[] = $article;
  94.             $article->setRssFeed($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeArticle(Article $article): self
  99.     {
  100.         if ($this->articles->removeElement($article)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($article->getRssFeed() === $this) {
  103.                 $article->setRssFeed(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function getLastSyncedAt(): ?string
  109.     {
  110.         return $this->last_synced_at;
  111.     }
  112.     public function setLastSyncedAt(string $last_synced_at): self
  113.     {
  114.         $this->last_synced_at $last_synced_at;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return mixed
  119.      */
  120.     public function getRssName(): ?string
  121.     {
  122.         return $this->rss_name;
  123.     }
  124.     /**
  125.      * @param mixed $rss_name
  126.      */
  127.     public function setRssName($rss_name): void
  128.     {
  129.         $this->rss_name $rss_name;
  130.     }
  131.     /**
  132.      * @return mixed
  133.      */
  134.     public function getActive()
  135.     {
  136.         return $this->active;
  137.     }
  138.     /**
  139.      * @param mixed $active
  140.      */
  141.     public function setActive($active): void
  142.     {
  143.         $this->active $active;
  144.     }
  145.     /**
  146.      * @return Collection|RssFeedCategory[]
  147.      */
  148.     public function getRssFeedCategories(): Collection
  149.     {
  150.         return $this->rssFeedCategories;
  151.     }
  152.     public function addRssFeedCategory(RssFeedCategory $rssFeedCategory): self
  153.     {
  154.         if (!$this->rssFeedCategories->contains($rssFeedCategory)) {
  155.             $this->rssFeedCategories[] = $rssFeedCategory;
  156.             $rssFeedCategory->setRssFeed($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeRssFeedCategory(RssFeedCategory $rssFeedCategory): self
  161.     {
  162.         if ($this->rssFeedCategories->contains($rssFeedCategory)) {
  163.             $this->rssFeedCategories->removeElement($rssFeedCategory);
  164.             // set the owning side to null (unless already changed)
  165.             if ($rssFeedCategory->getRssFeed() === $this) {
  166.                 $rssFeedCategory->setRssFeed(null);
  167.             }
  168.         }
  169.         return $this;
  170.     }
  171. }