Commentaire.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommentaireRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Table(name: "commentaire")]
  6. #[ORM\Entity(repositoryClass: CommentaireRepository::class)]
  7. class Commentaire
  8. {
  9. #[ORM\Column(name: "id", type: "integer")]
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue(strategy: "AUTO")]
  12. private $id;
  13. #[ORM\Column(name: "contenu", type: "text", length: 191, nullable: true)]
  14. private $contenu;
  15. #[ORM\Column(name: "note", type: "integer", nullable: true)]
  16. private $note;
  17. #[ORM\ManyToOne(targetEntity: Film::class, inversedBy: "commentaires")]
  18. #[ORM\JoinColumn(nullable: false)]
  19. private $film;
  20. #[ORM\ManyToOne(targetEntity: User::class)]
  21. #[ORM\JoinColumn(nullable: false)]
  22. private $user;
  23. #[ORM\Column(type: "datetime", nullable: true)]
  24. private $dateSubmitted;
  25. public function __construct ()
  26. {
  27. $this->dateSubmitted = new \DateTime('now');
  28. }
  29. public function getId(): ?int
  30. {
  31. return $this->id;
  32. }
  33. public function setContenu($contenu): self
  34. {
  35. $this->contenu = $contenu;
  36. return $this;
  37. }
  38. public function getContenu(): ?string
  39. {
  40. return $this->contenu;
  41. }
  42. public function getNote(): ?int
  43. {
  44. return $this->note;
  45. }
  46. public function setNote($note): self
  47. {
  48. $this->note = $note;
  49. return $this;
  50. }
  51. public function setFilm(\App\Entity\Film $film): self
  52. {
  53. $this->film = $film;
  54. return $this;
  55. }
  56. public function getFilm(): Film
  57. {
  58. return $this->film;
  59. }
  60. public function setUser(\App\Entity\User $user): self
  61. {
  62. $this->user = $user;
  63. return $this;
  64. }
  65. public function getUser(): User
  66. {
  67. return $this->user;
  68. }
  69. public function getDateSubmitted(): ?\DateTimeInterface
  70. {
  71. return $this->dateSubmitted;
  72. }
  73. public function setDateSubmitted(?\DateTimeInterface $dateSubmitted): self
  74. {
  75. $this->dateSubmitted = $dateSubmitted;
  76. return $this;
  77. }
  78. }