src/Entity/Notification.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NotificationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=NotificationRepository::class)
  7.  */
  8. class Notification
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="notifications")
  18.      * @ORM\JoinColumn(nullable=false)
  19.      */
  20.     private $user;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $message;
  25.     /**
  26.      * @ORM\Column(type="datetime_immutable")
  27.      */
  28.     private $created_at;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $link;
  33.     public function __construct($user$message$link null)
  34.     {
  35.         $this->user $user;
  36.         $this->message $message;
  37.         $this->link $link;
  38.         $this->created_at = new \DateTimeImmutable();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getUser(): ?User
  45.     {
  46.         return $this->user;
  47.     }
  48.     public function setUser(?User $user): self
  49.     {
  50.         $this->user $user;
  51.         return $this;
  52.     }
  53.     public function getMessage(): ?string
  54.     {
  55.         return $this->message;
  56.     }
  57.     public function setMessage(string $message): self
  58.     {
  59.         $this->message $message;
  60.         return $this;
  61.     }
  62.     public function getCreatedAt(): ?\DateTimeImmutable
  63.     {
  64.         return $this->created_at;
  65.     }
  66.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  67.     {
  68.         $this->created_at $created_at;
  69.         return $this;
  70.     }
  71.     public function getLink(): ?string
  72.     {
  73.         return $this->link;
  74.     }
  75.     public function setLink(?string $link): self
  76.     {
  77.         $this->link $link;
  78.         return $this;
  79.     }
  80. }