src/Entity/NotificationSystem.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NotificationSystemRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=NotificationSystemRepository::class)
  7.  * @ORM\HasLifecycleCallbacks
  8.  */
  9. class NotificationSystem
  10. {
  11.     public const NOTIFICATION_SYSTEM_DONT_READ 0;
  12.     public const NOTIFICATION_SYSTEM_READ      1;
  13.     public const CATEGORIES = [
  14.         => 'Betaling og lagerleie',
  15.         => 'Lagrede søk',
  16.         => 'Mine bud',
  17.         => 'Mine favoritter',
  18.         => 'Mine salg',
  19.     ];
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="notificationsSystem")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $customer;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=NotificationTemplate::class, inversedBy="notificationSystems")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $notification_template;
  36.     /**
  37.      * @ORM\Column(type="integer", options={"default" : 0})
  38.      */
  39.     private $status;
  40.     /**
  41.      * @ORM\Column(type="text")
  42.      */
  43.     private $message;
  44.     /**
  45.      * @ORM\Column(type="string")
  46.      */
  47.     private $related_item_id;
  48.     /**
  49.      * @ORM\Column(type="datetime", nullable=true)
  50.      */
  51.     private $created_at;
  52.     /**
  53.      * @ORM\Column(type="datetime", nullable=true)
  54.      */
  55.     private $updated_at;
  56.     private $related_item;
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getCustomer(): Customer
  62.     {
  63.         return $this->customer;
  64.     }
  65.     public function setCustomer(Customer $customer): self
  66.     {
  67.         $this->customer $customer;
  68.         return $this;
  69.     }
  70.     public function getNotificationTemplate(): NotificationTemplate
  71.     {
  72.         return $this->notification_template;
  73.     }
  74.     public function setNotificationTemplate(NotificationTemplate $notification_template): self
  75.     {
  76.         $this->notification_template $notification_template;
  77.         return $this;
  78.     }
  79.     public function getStatus(): ?int
  80.     {
  81.         return $this->status;
  82.     }
  83.     public function setStatus(int $status): self
  84.     {
  85.         $this->status $status;
  86.         return $this;
  87.     }
  88.     public function getMessage(): string
  89.     {
  90.         return $this->message;
  91.     }
  92.     public function setMessage(string $message): self
  93.     {
  94.         $this->message $message;
  95.         return $this;
  96.     }
  97.     public function getRelatedItemId(): ?string
  98.     {
  99.         return $this->related_item_id;
  100.     }
  101.     public function setRelatedItemId(?string $related_item_id): self
  102.     {
  103.         $this->related_item_id $related_item_id;
  104.         return $this;
  105.     }
  106.     public function getCreatedAt(): ?\DateTimeInterface
  107.     {
  108.         return $this->created_at;
  109.     }
  110.     public function setCreatedAt(?\DateTimeInterface $created_at): self
  111.     {
  112.         $this->created_at $created_at;
  113.         return $this;
  114.     }
  115.     public function getUpdatedAt(): ?\DateTimeInterface
  116.     {
  117.         return $this->updated_at;
  118.     }
  119.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  120.     {
  121.         $this->updated_at $updated_at;
  122.         return $this;
  123.     }
  124.     public function getRelatedItem(): ?array
  125.     {
  126.         return $this->related_item;
  127.     }
  128.     public function setRelatedItem(?array $related_item): self
  129.     {
  130.         $this->related_item $related_item;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @ORM\PrePersist
  135.      * @ORM\PreUpdate
  136.      */
  137.     public function updatedTimestamps(): void
  138.     {
  139.         $now = new \DateTime('now');
  140.         $this->setUpdatedAt($now);
  141.         if (null === $this->getCreatedAt()) {
  142.             $this->setCreatedAt($now);
  143.         }
  144.     }
  145. }