src/Entity/Blog.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass=BlogRepository::class)
  9.  * @UniqueEntity(fields={"slug"}, errorPath="title", message="post.slug_unique")
  10.  */
  11. class Blog
  12. {
  13.     use \App\Traits\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")
  26.      */
  27.     private $intro;
  28.     /**
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     private $content;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $slug;
  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\ManyToOne(targetEntity=User::class, inversedBy="blogs")
  46.      */
  47.     private $author;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      */
  51.     private $isActive;
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getTitle(): ?string
  57.     {
  58.         return $this->title;
  59.     }
  60.     public function setTitle(string $title): self
  61.     {
  62.         $this->title = $title;
  63.         return $this;
  64.     }
  65.     public function getIntro(): ?string
  66.     {
  67.         return $this->intro;
  68.     }
  69.     public function setIntro(string $intro): self
  70.     {
  71.         $this->intro = $intro;
  72.         return $this;
  73.     }
  74.     public function getContent(): ?string
  75.     {
  76.         return $this->content;
  77.     }
  78.     public function setContent(?string $content): self
  79.     {
  80.         $this->content = $content;
  81.         return $this;
  82.     }
  83.     public function getSlug(): ?string
  84.     {
  85.         return $this->slug;
  86.     }
  87.     public function setSlug(string $slug): self
  88.     {
  89.         $this->slug = $slug;
  90.         return $this;
  91.     }
  92.     public function getIllustration(): ?string
  93.     {
  94.         return $this->illustration;
  95.     }
  96.     public function setIllustration(?string $illustration): self
  97.     {
  98.         $this->illustration = $illustration;
  99.         return $this;
  100.     }
  101.     public function getBannerImg(): ?string
  102.     {
  103.         return $this->bannerImg;
  104.     }
  105.     public function setBannerImg(?string $bannerImg): self
  106.     {
  107.         $this->bannerImg = $bannerImg;
  108.         return $this;
  109.     }
  110.     public function getAuthor(): ?User
  111.     {
  112.         return $this->author;
  113.     }
  114.     public function setAuthor(?User $author): self
  115.     {
  116.         $this->author = $author;
  117.         return $this;
  118.     }
  119.     public function getIsActive(): ?bool
  120.     {
  121.         return $this->isActive;
  122.     }
  123.     public function setIsActive(bool $isActive): self
  124.     {
  125.         $this->isActive = $isActive;
  126.         return $this;
  127.     }
  128. }