src/Entity/Comment.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\SuperClass\BaseEntity;
  4. use App\Repository\CommentRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8. * @ORM\Entity(repositoryClass=CommentRepository::class)
  9. */
  10. class Comment extends BaseEntity
  11. {
  12. /**
  13. * @ORM\Column(type="text")
  14. */
  15. private $content;
  16. /**
  17. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments")
  18. * @ORM\JoinColumn(nullable=false)
  19. */
  20. private $created_by;
  21. /**
  22. * @ORM\ManyToOne(targetEntity=Post::class, inversedBy="comments")
  23. */
  24. private $post;
  25. public function getId(): ?int
  26. {
  27. return $this->id;
  28. }
  29. public function getContent(): ?string
  30. {
  31. return $this->content;
  32. }
  33. public function setContent(string $content): self
  34. {
  35. $this->content = $content;
  36. return $this;
  37. }
  38. public function getCreatedBy(): ?User
  39. {
  40. return $this->created_by;
  41. }
  42. public function setCreatedBy(?User $created_by): self
  43. {
  44. $this->created_by = $created_by;
  45. return $this;
  46. }
  47. public function getPost(): ?Post
  48. {
  49. return $this->post;
  50. }
  51. public function setPost(?Post $post): self
  52. {
  53. $this->post = $post;
  54. return $this;
  55. }
  56. }