src/Entity/Notification.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NotificationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. /**
  7.  * @ORM\Entity(repositoryClass=NotificationRepository::class)
  8.  * @ORM\HasLifecycleCallbacks()
  9.  */
  10. class Notification
  11. {
  12.     const CATEGORY_APPOINTMENT_FEEDBACK 'appt_fb';
  13.     const CATEGORY_APPOINTMENT_FEEDBACK_GLOBAL 'appt_fb_all';
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=7)
  22.      */
  23.     private $type;
  24.     /**
  25.      * @ORM\Column(type="datetime")
  26.      * @Gedmo\Timestampable(on="create")
  27.      */
  28.     private $createdAt;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=User::class)
  31.      */
  32.     private $user;
  33.     /**
  34.      * @ORM\Column(type="text")
  35.      */
  36.     private $message;
  37.     /**
  38.      * @ORM\Column(type="datetime", nullable=true)
  39.      */
  40.     private $closedAt;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $title;
  45.     /**
  46.      * @ORM\Column(type="datetime", nullable=true)
  47.      */
  48.     private $scheduledAt;
  49.     /**
  50.      * @ORM\Column(type="string", length=25, nullable=true)
  51.      */
  52.     private $category;
  53.     /**
  54.      * @ORM\Column(type="string", length=255)
  55.      */
  56.     private $hash;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $url;
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getType(): ?string
  66.     {
  67.         return $this->type;
  68.     }
  69.     public function setType(string $type): self
  70.     {
  71.         $this->type $type;
  72.         return $this;
  73.     }
  74.     public function getCreatedAt(): ?\DateTimeInterface
  75.     {
  76.         return $this->createdAt;
  77.     }
  78.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  79.     {
  80.         $this->createdAt $createdAt;
  81.         return $this;
  82.     }
  83.     public function getUser(): ?User
  84.     {
  85.         return $this->user;
  86.     }
  87.     public function isClosable(): bool
  88.     {
  89.         return !empty($this->user);
  90.     }
  91.     public function setUser(?User $user): self
  92.     {
  93.         $this->user $user;
  94.         return $this;
  95.     }
  96.     public function getMessage(): ?string
  97.     {
  98.         return $this->message;
  99.     }
  100.     public function setMessage(string $message): self
  101.     {
  102.         $this->message $message;
  103.         return $this;
  104.     }
  105.     public function getClosedAt(): ?\DateTimeInterface
  106.     {
  107.         return $this->closedAt;
  108.     }
  109.     public function setClosedAt(?\DateTimeInterface $closedAt): self
  110.     {
  111.         $this->closedAt $closedAt;
  112.         return $this;
  113.     }
  114.     public function markAsClosed(): self
  115.     {
  116.         return $this->setClosedAt(new \DateTime());
  117.     }
  118.     public function getTitle(): ?string
  119.     {
  120.         return $this->title;
  121.     }
  122.     public function setTitle(?string $title): self
  123.     {
  124.         $this->title $title;
  125.         return $this;
  126.     }
  127.     public function getScheduledAt(): ?\DateTimeInterface
  128.     {
  129.         return $this->scheduledAt;
  130.     }
  131.     public function setScheduledAt(?\DateTimeInterface $scheduledAt): self
  132.     {
  133.         $this->scheduledAt $scheduledAt;
  134.         return $this;
  135.     }
  136.     public function getCategory(): ?string
  137.     {
  138.         return $this->category;
  139.     }
  140.     public function setCategory(?string $category): self
  141.     {
  142.         $this->category $category;
  143.         return $this;
  144.     }
  145.     public function getHash(): ?string
  146.     {
  147.         return $this->hash;
  148.     }
  149.     public function setHash(string $hash): self
  150.     {
  151.         $this->hash $hash;
  152.         return $this;
  153.     }
  154.     /**
  155.      * @ORM\PrePersist
  156.      */
  157.     public function computeHash()
  158.     {
  159.         $this->hash md5($this->title $this->message $this->type);
  160.         return $this->hash;
  161.     }
  162.     public function getUrl(): ?string
  163.     {
  164.         return $this->url;
  165.     }
  166.     public function setUrl(?string $url): self
  167.     {
  168.         $this->url $url;
  169.         return $this;
  170.     }
  171. }