EventReport.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php
  2. namespace AppBundle\Entity\Booking;
  3. use AppBundle\Entity\Core\File;
  4. use AppBundle\Entity\Message\Message;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Dunglas\ApiBundle\Annotation\Iri;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use AppBundle\Entity\Traits\TimestampableEntity;
  11. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  12. /**
  13. * Compte-rendu d'un évènement Event
  14. *
  15. * @Iri("http://schema.org/EventReport")
  16. */
  17. #[ORM\Entity]
  18. class EventReport
  19. {
  20. use TimestampableEntity;
  21. use CreatorUpdaterEntity;
  22. /**
  23. * @var int
  24. */
  25. #[ORM\Column(type: 'integer')]
  26. #[ORM\Id]
  27. #[ORM\GeneratedValue(strategy: 'AUTO')]
  28. #[Groups(['eventreport', 'event_details'])]
  29. private $id;
  30. /**
  31. * @var Event
  32. */
  33. #[ORM\ManyToOne(targetEntity: 'Event', inversedBy: 'eventReports')]
  34. #[Groups(['eventreport'])]
  35. private $event;
  36. /**
  37. * @var string
  38. */
  39. #[ORM\Column(type: 'text', nullable: true)]
  40. #[Assert\Type(type: 'string')]
  41. #[Groups(['eventreport', 'event_details_eventreports'])]
  42. private $report;
  43. /**
  44. * @var \DateTime
  45. */
  46. #[ORM\Column(type: 'date', nullable: false)]
  47. #[Assert\Date]
  48. #[Assert\NotNull]
  49. #[Groups(['eventreport', 'event_details_eventreports'])]
  50. private $date;
  51. /**
  52. * @var ArrayCollection<AppBundle\Entity\Core\File>.
  53. */
  54. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'eventReport', orphanRemoval: true)]
  55. #[Groups(['eventreport', 'event_details_eventreports'])]
  56. private $files;
  57. public function __construct() {
  58. $this->files = new ArrayCollection();
  59. }
  60. /**
  61. * Sets id.
  62. *
  63. * @param int $id
  64. *
  65. * @return $this
  66. */
  67. public function setId($id)
  68. {
  69. $this->id = $id;
  70. return $this;
  71. }
  72. /**
  73. * Gets id.
  74. *
  75. * @return int
  76. */
  77. public function getId()
  78. {
  79. return $this->id;
  80. }
  81. /**
  82. * Set report
  83. *
  84. * @param string $report
  85. *
  86. * @return EventReport
  87. */
  88. public function setReport($report)
  89. {
  90. $this->report = $report;
  91. return $this;
  92. }
  93. /**
  94. * Get report
  95. *
  96. * @return string
  97. */
  98. public function getReport()
  99. {
  100. return $this->report;
  101. }
  102. /**
  103. * Set date
  104. *
  105. * @param \DateTime $date
  106. *
  107. * @return EventReport
  108. */
  109. public function setDate($date)
  110. {
  111. $this->date = $date;
  112. return $this;
  113. }
  114. /**
  115. * Get date
  116. *
  117. * @return \DateTime
  118. */
  119. public function getDate()
  120. {
  121. return $this->date;
  122. }
  123. /**
  124. * Set event
  125. *
  126. * @param \AppBundle\Entity\Booking\Event $event
  127. *
  128. * @return EventReport
  129. */
  130. public function setEvent(\AppBundle\Entity\Booking\Event $event = null)
  131. {
  132. $this->event = $event;
  133. return $this;
  134. }
  135. /**
  136. * Get event
  137. *
  138. * @return \AppBundle\Entity\Booking\Event
  139. */
  140. public function getEvent()
  141. {
  142. return $this->event;
  143. }
  144. /**
  145. * Add file
  146. *
  147. * @param File $file
  148. *
  149. * @return Message
  150. */
  151. public function addFile(File $file)
  152. {
  153. $file->setEventReport($this);
  154. $this->files[] = $file;
  155. return $this;
  156. }
  157. /**
  158. * Remove file
  159. *
  160. * @param File $file
  161. */
  162. public function removeFile(File $file)
  163. {
  164. $this->files->removeElement($file);
  165. }
  166. /**
  167. * Get files
  168. *
  169. * @return \Doctrine\Common\Collections\Collection
  170. */
  171. public function getFiles()
  172. {
  173. return $this->files;
  174. }
  175. }