src/Entity/ContentComment.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation\Exclude;
  5. use JMS\Serializer\Annotation\Groups;
  6. /**
  7.  * @ORM\Table("ContentComment")
  8.  *
  9.  * @ORM\Entity(repositoryClass="App\Repository\ContentCommentRepository")
  10.  */
  11. class ContentComment
  12. {
  13.     /**
  14.      * @Groups({"commentlist", "timelineindex"})
  15.      *
  16.      * @ORM\Id()
  17.      *
  18.      * @ORM\GeneratedValue()
  19.      *
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @Groups({"commentlist", "timelineindex"})
  25.      *
  26.      * @ORM\ManyToOne(targetEntity="App\Entity\Member")
  27.      *
  28.      * @ORM\JoinColumn(name="member_id", referencedColumnName="id", onDelete="SET NULL")
  29.      */
  30.     private $member;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity="App\Entity\Purchase")
  33.      *
  34.      * @ORM\JoinColumn(name="purchase_id", referencedColumnName="id", onDelete="SET NULL", nullable=true)
  35.      */
  36.     private $purchase;
  37.     /**
  38.      * @Groups({"commentlist", "timelineindex"})
  39.      *
  40.      * @ORM\Column(type="smallint", nullable=true)
  41.      */
  42.     private $vote;
  43.     /**
  44.      * @Exclude
  45.      *
  46.      * @Groups({"commentlist"})
  47.      *
  48.      * @ORM\ManyToOne(targetEntity="Content", inversedBy="comments")
  49.      *
  50.      * @ORM\JoinColumn(name="content_id", referencedColumnName="id", onDelete="CASCADE")
  51.      */
  52.     private $content;
  53.     /**
  54.      * @Groups({"commentlist", "timelineindex"})
  55.      *
  56.      * @ORM\Column(type="text", nullable=true)
  57.      */
  58.     private $text;
  59.     /**
  60.      * @Groups({"commentlist", "timelineindex"})
  61.      *
  62.      * @ORM\Column(type="datetime")
  63.      */
  64.     private $created_at;
  65.     public function __construct()
  66.     {
  67.         $this->setCreatedAt(new \DateTime());
  68.     }
  69.     public function getId()
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function setContent(Content $content): self
  74.     {
  75.         $this->content $content;
  76.         return $this;
  77.     }
  78.     public function getContent(): Content
  79.     {
  80.         return $this->content;
  81.     }
  82.     public function getVote(): ?int
  83.     {
  84.         return $this->vote;
  85.     }
  86.     public function setVote(?int $vote): self
  87.     {
  88.         $this->vote $vote;
  89.         return $this;
  90.     }
  91.     public function getText(): ?string
  92.     {
  93.         return $this->text;
  94.     }
  95.     public function setText(?string $text): self
  96.     {
  97.         $this->text $text;
  98.         return $this;
  99.     }
  100.     public function getMember(): Member
  101.     {
  102.         return $this->member;
  103.     }
  104.     public function setMember(Member $member): self
  105.     {
  106.         $this->member $member;
  107.         return $this;
  108.     }
  109.     public function setPurchase(?Purchase $purchase): self
  110.     {
  111.         $this->purchase $purchase;
  112.         return $this;
  113.     }
  114.     public function getPurchase(): ?Purchase
  115.     {
  116.         return $this->purchase;
  117.     }
  118.     public function getCreatedAt(): ?\DateTime
  119.     {
  120.         return $this->created_at;
  121.     }
  122.     public function setCreatedAt(\DateTime $created_at): self
  123.     {
  124.         $this->created_at $created_at;
  125.         return $this;
  126.     }
  127. }