src/Entity/Notification.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NotificationRepository;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(
  7.     repositoryClassNotificationRepository::class
  8. )]
  9. #[ORM\Table(
  10.     name'notifications'
  11. )]
  12. class Notification
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(
  17.         type'integer'
  18.     )]
  19.     private ?int $id null;
  20.     #[ORM\ManyToOne(
  21.         targetEntityUser::class
  22.     )]
  23.     #[ORM\JoinColumn(
  24.         name'sender',
  25.         nullabletrue
  26.     )]
  27.     private ?User $sender null;
  28.     #[ORM\ManyToOne(
  29.         targetEntityUser::class,
  30.         inversedBy'notification'
  31.     )]
  32.     #[ORM\JoinColumn(
  33.         name'recipient',
  34.         nullablefalse
  35.     )]
  36.     private User $recipient;
  37.     #[ORM\Column(
  38.         name'send_date',
  39.         type'datetime',
  40.         nullablefalse
  41.     )]
  42.     private DateTime $sendDate;
  43.     #[ORM\Column(
  44.         name'read_date',
  45.         type'datetime',
  46.         nullabletrue
  47.     )]
  48.     private ?DateTime $readDate null;
  49.     #[ORM\Column(
  50.         name'message',
  51.         type'text',
  52.         nullablefalse
  53.     )]
  54.     private string $message;
  55.     #[ORM\Column(
  56.         name'send_to_mail',
  57.         type'boolean',
  58.         nullablefalse
  59.     )]
  60.     private bool $sendToMail false;
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function setId($id): self
  66.     {
  67.         $this->id $id;
  68.         return $this;
  69.     }
  70.     public function getSender(): ?User
  71.     {
  72.         return $this->sender;
  73.     }
  74.     public function setSender(?User $sender): self
  75.     {
  76.         $this->sender $sender;
  77.         return $this;
  78.     }
  79.     public function getRecipient(): User
  80.     {
  81.         return $this->recipient;
  82.     }
  83.     public function setRecipient(User $recipient): self
  84.     {
  85.         $this->recipient $recipient;
  86.         return $this;
  87.     }
  88.     public function getSendDate(): DateTime
  89.     {
  90.         return $this->sendDate;
  91.     }
  92.     public function setSendDate(DateTime $sendDate): self
  93.     {
  94.         $this->sendDate $sendDate;
  95.         return $this;
  96.     }
  97.     public function getReadDate(): ?DateTime
  98.     {
  99.         return $this->readDate;
  100.     }
  101.     public function setReadDate(?DateTime $readDate): self
  102.     {
  103.         $this->readDate $readDate;
  104.         return $this;
  105.     }
  106.     public function getMessage(): string
  107.     {
  108.         return $this->message;
  109.     }
  110.     public function setMessage(string $message): self
  111.     {
  112.         $this->message $message;
  113.         return $this;
  114.     }
  115.     public function isSendToMail(): bool
  116.     {
  117.         return $this->sendToMail;
  118.     }
  119.     public function setMail(bool $sendToMail): self
  120.     {
  121.         $this->sendToMail $sendToMail;
  122.         return $this;
  123.     }
  124. }