src/Entity/Blog.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogRepository;
  4. use App\Traits\CommonTrt;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=BlogRepository::class)
  10.  */
  11. class Blog
  12. {
  13.     use CommonTrt;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $title;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $content;
  28.     /**
  29.      * @ORM\Column(type="datetime_immutable", nullable=true)
  30.      */
  31.     private $publishedAt;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $slug;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Lang::class, inversedBy="blogs")
  38.      */
  39.     private $langue;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $author;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=true)
  46.      */
  47.     private $illustration;
  48.     /**
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $bannerImg;
  52.     /**
  53.      * @ORM\Column(type="boolean")
  54.      */
  55.     private $isActive;
  56.     /**
  57.      * @ORM\Column(type="boolean")
  58.      */
  59.     private $isForHome;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=BlogCategory::class, inversedBy="blog")
  62.      */
  63.     private $category;
  64.     /**
  65.      * @ORM\Column(type="boolean")
  66.      */
  67.     private $isPopular;
  68. //    /**
  69. //     * @ORM\ManyToMany(targetEntity=BlogCategory::class, inversedBy="blogs")
  70. //     */
  71. //    private $category;
  72.     public function __construct()
  73.     {
  74.         $this->category = new ArrayCollection();
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getTitle(): ?string
  81.     {
  82.         return $this->title;
  83.     }
  84.     public function setTitle(string $title): self
  85.     {
  86.         $this->title = $title;
  87.         return $this;
  88.     }
  89. //    public function getSummary(): ?string
  90. //    {
  91. //        return $this->summary;
  92. //    }
  93. //
  94. //    public function setSummary(?string $summary): self
  95. //    {
  96. //        $this->summary = $summary;
  97. //
  98. //        return $this;
  99. //    }
  100.     public function getContent(): ?string
  101.     {
  102.         return $this->content;
  103.     }
  104.     public function setContent(?string $content): self
  105.     {
  106.         $this->content = $content;
  107.         return $this;
  108.     }
  109.     public function getPublishedAt(): ?\DateTimeImmutable
  110.     {
  111.         return $this->publishedAt;
  112.     }
  113.     public function setPublishedAt(?\DateTimeImmutable $publishedAt): self
  114.     {
  115.         $this->publishedAt = $publishedAt;
  116.         return $this;
  117.     }
  118.     public function getSlug(): ?string
  119.     {
  120.         return $this->slug;
  121.     }
  122.     public function setSlug(string $slug): self
  123.     {
  124.         $this->slug = $slug;
  125.         return $this;
  126.     }
  127.     public function getLangue(): ?Lang
  128.     {
  129.         return $this->langue;
  130.     }
  131.     public function setLangue(?Lang $langue): self
  132.     {
  133.         $this->langue = $langue;
  134.         return $this;
  135.     }
  136.     public function getAuthor(): ?string
  137.     {
  138.         return $this->author;
  139.     }
  140.     public function setAuthor(?string $author): self
  141.     {
  142.         $this->author = $author;
  143.         return $this;
  144.     }
  145.     public function getIllustration(): ?string
  146.     {
  147.         return $this->illustration;
  148.     }
  149.     public function setIllustration(?string $illustration): self
  150.     {
  151.         $this->illustration = $illustration;
  152.         return $this;
  153.     }
  154.     public function getBannerImg(): ?string
  155.     {
  156.         return $this->bannerImg;
  157.     }
  158.     public function setBannerImg(?string $bannerImg): self
  159.     {
  160.         $this->bannerImg = $bannerImg;
  161.         return $this;
  162.     }
  163.     public function isIsActive(): ?bool
  164.     {
  165.         return $this->isActive;
  166.     }
  167.     public function setIsActive(bool $isActive): self
  168.     {
  169.         $this->isActive = $isActive;
  170.         return $this;
  171.     }
  172.     public function isIsForHome(): ?bool
  173.     {
  174.         return $this->isForHome;
  175.     }
  176.     public function setIsForHome(bool $isForHome): self
  177.     {
  178.         $this->isForHome = $isForHome;
  179.         return $this;
  180.     }
  181. //    /**
  182. //     * @return Collection<int, BlogCategory>
  183. //     */
  184. //    public function getCategory(): Collection
  185. //    {
  186. //        return $this->category;
  187. //    }
  188. //
  189. //    public function addCategory(BlogCategory $category): self
  190. //    {
  191. //        if (!$this->category->contains($category)) {
  192. //            $this->category[] = $category;
  193. //        }
  194. //
  195. //        return $this;
  196. //    }
  197. //
  198. //    public function removeCategory(BlogCategory $category): self
  199. //    {
  200. //        $this->category->removeElement($category);
  201. //
  202. //        return $this;
  203. //    }
  204. public function getCategory(): ?BlogCategory
  205. {
  206.     return $this->category;
  207. }
  208. public function setCategory(?BlogCategory $category): self
  209. {
  210.     $this->category = $category;
  211.     return $this;
  212. }
  213. public function isIsPopular(): ?bool
  214. {
  215.     return $this->isPopular;
  216. }
  217. public function setIsPopular(bool $isPopular): self
  218. {
  219.     $this->isPopular = $isPopular;
  220.     return $this;
  221. }
  222. }