src/Entity/News.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NewsRepository;
  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=NewsRepository::class)
  10.  */
  11. class News
  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="string", length=255)
  26.      */
  27.     private $slug;
  28.     /**
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     private $summary;
  32.     /**
  33.      * @ORM\Column(type="text", nullable=true)
  34.      */
  35.     private $content;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      */
  39.     private $illustration;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $bannerImg;
  44.     /**
  45.      * @ORM\Column(type="boolean")
  46.      */
  47.     private $isActive;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      */
  51.     private $isHome;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity=Lang::class, inversedBy="news")
  54.      */
  55.     private $langue;
  56.     /**
  57.      * @ORM\Column(type="datetime_immutable", nullable=true)
  58.      */
  59.     private $publishedAt;
  60.     /**
  61.      * @ORM\ManyToMany(targetEntity=Documents::class, inversedBy="news")
  62.      */
  63.     private $docs;
  64.     /**
  65.      * @ORM\Column(type="boolean")
  66.      */
  67.     private $isPopular;
  68.     /**
  69.      * @ORM\Column(type="integer", nullable=true)
  70.      */
  71.     private $orderNumber;
  72.     public function __construct()
  73.     {
  74.         $this->docs = 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 getSlug(): ?string
  90.     {
  91.         return $this->slug;
  92.     }
  93.     public function setSlug(string $slug): self
  94.     {
  95.         $this->slug = $slug;
  96.         return $this;
  97.     }
  98.     public function getSummary(): ?string
  99.     {
  100.         return $this->summary;
  101.     }
  102.     public function setSummary(?string $summary): self
  103.     {
  104.         $this->summary = $summary;
  105.         return $this;
  106.     }
  107.     public function getContent(): ?string
  108.     {
  109.         return $this->content;
  110.     }
  111.     public function setContent(?string $content): self
  112.     {
  113.         $this->content = $content;
  114.         return $this;
  115.     }
  116.     public function getIllustration(): ?string
  117.     {
  118.         return $this->illustration;
  119.     }
  120.     public function setIllustration(?string $illustration): self
  121.     {
  122.         $this->illustration = $illustration;
  123.         return $this;
  124.     }
  125.     public function getBannerImg(): ?string
  126.     {
  127.         return $this->bannerImg;
  128.     }
  129.     public function setBannerImg(?string $bannerImg): self
  130.     {
  131.         $this->bannerImg = $bannerImg;
  132.         return $this;
  133.     }
  134.     public function isIsActive(): ?bool
  135.     {
  136.         return $this->isActive;
  137.     }
  138.     public function setIsActive(bool $isActive): self
  139.     {
  140.         $this->isActive = $isActive;
  141.         return $this;
  142.     }
  143.     public function isIsHome(): ?bool
  144.     {
  145.         return $this->isHome;
  146.     }
  147.     public function setIsHome(bool $isHome): self
  148.     {
  149.         $this->isHome = $isHome;
  150.         return $this;
  151.     }
  152.     public function getLangue(): ?Lang
  153.     {
  154.         return $this->langue;
  155.     }
  156.     public function setLangue(?Lang $langue): self
  157.     {
  158.         $this->langue = $langue;
  159.         return $this;
  160.     }
  161.     public function getPublishedAt(): ?\DateTimeImmutable
  162.     {
  163.         return $this->publishedAt;
  164.     }
  165.     public function setPublishedAt(\DateTimeImmutable $publishedAt): self
  166.     {
  167.         $this->publishedAt = $publishedAt;
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Documents>
  172.      */
  173.     public function getDocs(): Collection
  174.     {
  175.         return $this->docs;
  176.     }
  177.     public function addDoc(Documents $doc): self
  178.     {
  179.         if (!$this->docs->contains($doc)) {
  180.             $this->docs[] = $doc;
  181.         }
  182.         return $this;
  183.     }
  184.     public function removeDoc(Documents $doc): self
  185.     {
  186.         $this->docs->removeElement($doc);
  187.         return $this;
  188.     }
  189.     public function isIsPopular(): ?bool
  190.     {
  191.         return $this->isPopular;
  192.     }
  193.     public function setIsPopular(bool $isPopular): self
  194.     {
  195.         $this->isPopular = $isPopular;
  196.         return $this;
  197.     }
  198.     public function __toString()
  199.     {
  200.         return $this->title;
  201.     }
  202.     public function getOrderNumber(): ?int
  203.     {
  204.         return $this->orderNumber;
  205.     }
  206.     public function setOrderNumber(?int $orderNumber): self
  207.     {
  208.         $this->orderNumber = $orderNumber;
  209.         return $this;
  210.     }
  211. }