NotificationUser.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use AppBundle\Entity\Traits\TimestampableEntity;
  5. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  6. use AppBundle\Annotation\DefaultField;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11. * Fais le lien entre une Notification et un Access
  12. */
  13. #[ORM\Entity]
  14. class NotificationUser
  15. {
  16. use TimestampableEntity;
  17. use CreatorUpdaterEntity;
  18. /**
  19. * @var int
  20. */
  21. #[ORM\Column(type: 'integer')]
  22. #[ORM\Id]
  23. #[ORM\GeneratedValue(strategy: 'AUTO')]
  24. #[Groups(['notificationuser'])]
  25. private $id;
  26. /**
  27. * @var Notification
  28. */
  29. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\AbstractInformation', inversedBy: 'notificationUsers')]
  30. #[ORM\JoinColumn(nullable: false)]
  31. #[Groups(['notificationuser'])]
  32. private $notification;
  33. /**
  34. * @var Access
  35. *
  36. * @DefaultField
  37. */
  38. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'notificationUsers')]
  39. #[ORM\JoinColumn(nullable: false)]
  40. #[Groups(['notificationuser'])]
  41. private $access;
  42. /**
  43. * @var boolean
  44. */
  45. #[ORM\Column(type: 'boolean', options: ['default' => 0])]
  46. #[Assert\Type(type: 'boolean')]
  47. #[Groups(['notificationuser'])]
  48. private $isRead = 0;
  49. /**
  50. * Get id
  51. *
  52. * @return integer
  53. */
  54. public function getId()
  55. {
  56. return $this->id;
  57. }
  58. /**
  59. * Set isRead
  60. *
  61. * @param boolean $isRead
  62. *
  63. * @return NotificationUser
  64. */
  65. public function setIsRead($isRead)
  66. {
  67. $this->isRead = $isRead;
  68. return $this;
  69. }
  70. /**
  71. * Get isRead
  72. *
  73. * @return boolean
  74. */
  75. public function getIsRead()
  76. {
  77. return $this->isRead;
  78. }
  79. /**
  80. * Set notification
  81. *
  82. * @param AbstractInformation $notification
  83. *
  84. * @return NotificationUser
  85. */
  86. public function setNotification(AbstractInformation $notification)
  87. {
  88. $this->notification = $notification;
  89. return $this;
  90. }
  91. /**
  92. * Get notification
  93. *
  94. * @return Notification
  95. */
  96. public function getNotification()
  97. {
  98. return $this->notification;
  99. }
  100. /**
  101. * Set access
  102. *
  103. * @param Access $access
  104. *
  105. * @return NotificationUser
  106. */
  107. public function setAccess(Access $access)
  108. {
  109. $this->access = $access;
  110. return $this;
  111. }
  112. /**
  113. * Get access
  114. *
  115. * @return Access
  116. */
  117. public function getAccess()
  118. {
  119. return $this->access;
  120. }
  121. }