src/Entity/UserComment.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Timestampable\Traits\TimestampableEntity;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\UserCommentRepository")
  9.  */
  10. class UserComment
  11. {
  12.     use TimestampableEntity;
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({"ArticleComment"})
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity="App\Entity\Article", inversedBy="userComments")
  22.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  23.      */
  24.     private $article;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  27.      * @ORM\JoinColumn(nullable=false)
  28.      * @Groups({"ArticleComment"})
  29.      */
  30.     private $user;
  31.     /**
  32.      * @ORM\Column(type="text")
  33.      * @Assert\NotBlank()
  34.      * @Groups({"ArticleComment"})
  35.      */
  36.     private $content;
  37.     /**
  38.      * @ORM\Column(type="boolean")
  39.      * @Assert\Type(type="boolean")
  40.      * @Groups({"ArticleComment"})
  41.      */
  42.     private $isAnonymous;
  43.     /**
  44.      * @ORM\Column(type="boolean")
  45.      * @Assert\Type(type="boolean")
  46.      */
  47.     private $flagged;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      * @Assert\Type(type="boolean")
  51.      */
  52.     private $blocked;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity="App\Entity\Review", inversedBy="userComments")
  55.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  56.      */
  57.     private $review;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity="App\Entity\Newsroom", inversedBy="userComments")
  60.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  61.      */
  62.     private $newsroom;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity="App\Entity\Blog", inversedBy="userComments")
  65.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  66.      */
  67.     private $blog;
  68.     public function __construct()
  69.     {
  70.         $this->isAnonymous true;
  71.         $this->flagged false;
  72.         $this->blocked false;
  73.     }
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getArticle(): ?Article
  79.     {
  80.         return $this->article;
  81.     }
  82.     public function setArticle(?Article $article): self
  83.     {
  84.         $this->article $article;
  85.         return $this;
  86.     }
  87.     public function getUser(): ?User
  88.     {
  89.         return $this->user;
  90.     }
  91.     public function setUser(?User $user): self
  92.     {
  93.         $this->user $user;
  94.         return $this;
  95.     }
  96.     public function getContent(): ?string
  97.     {
  98.         return $this->content;
  99.     }
  100.     public function setContent(?string $content): self
  101.     {
  102.         $this->content $content;
  103.         return $this;
  104.     }
  105.     public function getIsAnonymous(): ?bool
  106.     {
  107.         return $this->isAnonymous;
  108.     }
  109.     public function setIsAnonymous(bool $isAnonymous): self
  110.     {
  111.         $this->isAnonymous $isAnonymous;
  112.         return $this;
  113.     }
  114.     public function getFlagged(): ?bool
  115.     {
  116.         return $this->flagged;
  117.     }
  118.     public function setFlagged(bool $flagged): self
  119.     {
  120.         $this->flagged $flagged;
  121.         return $this;
  122.     }
  123.     public function getBlocked(): ?bool
  124.     {
  125.         return $this->blocked;
  126.     }
  127.     public function setBlocked(bool $blocked): self
  128.     {
  129.         $this->blocked $blocked;
  130.         return $this;
  131.     }
  132.     public function getReview(): ?Review
  133.     {
  134.         return $this->review;
  135.     }
  136.     public function setReview(?Review $review): self
  137.     {
  138.         $this->review $review;
  139.         return $this;
  140.     }
  141.     public function getNewsroom(): ?Newsroom
  142.     {
  143.         return $this->newsroom;
  144.     }
  145.     public function setNewsroom(?Newsroom $newsroom): self
  146.     {
  147.         $this->newsroom $newsroom;
  148.         return $this;
  149.     }
  150.     public function getBlog(): ?Blog
  151.     {
  152.         return $this->blog;
  153.     }
  154.     public function setBlog(?Blog $blog): self
  155.     {
  156.         $this->blog $blog;
  157.         return $this;
  158.     }
  159. }