Notification.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Dunglas\ApiBundle\Annotation\Iri;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use AppBundle\Entity\Traits\TimestampableEntity;
  9. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  10. use AppBundle\Entity\Organization\Organization;
  11. use AppBundle\Entity\AccessAndFunction\Access;
  12. /**
  13. * Notification
  14. *
  15. * @Iri("http://schema.org/Notification")
  16. */
  17. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Core\Repository\NotificationRepository')]
  18. class Notification extends AbstractInformation
  19. {
  20. /**
  21. * @var string
  22. */
  23. #[ORM\Column(type: 'json_array', nullable: false)]
  24. #[Assert\NotNull]
  25. #[Groups(['notification', 'notification_list'])]
  26. private $message;
  27. /**
  28. * @var string
  29. */
  30. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  31. #[Assert\Type(type: 'string')]
  32. #[Groups(['notification', 'notification_list'])]
  33. private $link;
  34. /**
  35. * @var Access
  36. */
  37. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'notifications')]
  38. #[ORM\JoinColumn(nullable: true)]
  39. #[Groups(['super_admin'])]
  40. private $recipientAccess;
  41. /**
  42. * @var Organization
  43. */
  44. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'notifications')]
  45. #[ORM\JoinColumn(nullable: true)]
  46. #[Groups(['super_admin'])]
  47. private $recipientOrganization;
  48. /**
  49. * @var string
  50. */
  51. #[ORM\Column(type: 'string')]
  52. #[Assert\Type(type: 'string')]
  53. #[Assert\NotNull]
  54. #[Assert\Choice(callback: ['\AppBundle\Enum\Core\NotificationTypeEnum', 'toArray'])]
  55. #[Groups(['notification', 'notification_list'])]
  56. private $type;
  57. /**
  58. * @var \DateTime
  59. */
  60. #[ORM\Column(type: 'date', nullable: true)]
  61. #[Assert\Date]
  62. #[Groups(['notification'])]
  63. private $availabilityDate;
  64. public function __construct() {
  65. }
  66. /**
  67. * Gets link.
  68. *
  69. * @return string
  70. */
  71. public function getLink() {
  72. return $this->link;
  73. }
  74. /**
  75. * Gets recipientAccess
  76. *
  77. * @return Access
  78. */
  79. public function getRecipientAccess() {
  80. return $this->recipientAccess;
  81. }
  82. /**
  83. * Gets recipientOrganization.
  84. *
  85. * @return Organization
  86. */
  87. public function getRecipientOrganization() {
  88. return $this->recipientOrganization;
  89. }
  90. /**
  91. * Sets link.
  92. *
  93. * @param string $link
  94. * @return $this
  95. */
  96. public function setLink($link) {
  97. $this->link = $link;
  98. return $this;
  99. }
  100. /**
  101. * Sets recipientAccess.
  102. *
  103. * @param Access $recipientAccess
  104. * @return $this
  105. */
  106. public function setRecipientAccess(Access $recipientAccess = null) {
  107. $this->recipientAccess = $recipientAccess;
  108. return $this;
  109. }
  110. /**
  111. * Sets recipientOrganization.
  112. *
  113. * @param Organization $recipientOrganization
  114. * @return $this
  115. */
  116. public function setRecipientOrganization(Organization $recipientOrganization = null) {
  117. $this->recipientOrganization = $recipientOrganization;
  118. return $this;
  119. }
  120. /**
  121. * Gets type.
  122. *
  123. * @return string
  124. */
  125. public function getType() {
  126. return $this->type;
  127. }
  128. /**
  129. * Sets type.
  130. *
  131. * @param string $type
  132. * @return $this
  133. */
  134. public function setType($type) {
  135. $this->type = $type;
  136. return $this;
  137. }
  138. /**
  139. * Set message
  140. *
  141. * @param array $message
  142. *
  143. * @return Notification
  144. */
  145. public function setMessage($message)
  146. {
  147. $this->message = $message;
  148. return $this;
  149. }
  150. /**
  151. * Get message
  152. *
  153. * @return array
  154. */
  155. public function getMessage()
  156. {
  157. return $this->message;
  158. }
  159. /**
  160. * Set availabilityDate
  161. *
  162. * @param \DateTime $availabilityDate
  163. *
  164. * @return Notification
  165. */
  166. public function setAvailabilityDate($availabilityDate)
  167. {
  168. $this->availabilityDate = $availabilityDate;
  169. return $this;
  170. }
  171. /**
  172. * Get availabilityDate
  173. *
  174. * @return \DateTime
  175. */
  176. public function getAvailabilityDate()
  177. {
  178. return $this->availabilityDate;
  179. }
  180. }