<?php
namespace App\Entity;
use App\Repository\NotificationSystemRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=NotificationSystemRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class NotificationSystem
{
public const NOTIFICATION_SYSTEM_DONT_READ = 0;
public const NOTIFICATION_SYSTEM_READ = 1;
public const CATEGORIES = [
1 => 'Betaling og lagerleie',
2 => 'Lagrede søk',
3 => 'Mine bud',
4 => 'Mine favoritter',
5 => 'Mine salg',
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="notificationsSystem")
* @ORM\JoinColumn(nullable=false)
*/
private $customer;
/**
* @ORM\ManyToOne(targetEntity=NotificationTemplate::class, inversedBy="notificationSystems")
* @ORM\JoinColumn(nullable=false)
*/
private $notification_template;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
private $status;
/**
* @ORM\Column(type="text")
*/
private $message;
/**
* @ORM\Column(type="string")
*/
private $related_item_id;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updated_at;
private $related_item;
public function getId(): ?int
{
return $this->id;
}
public function getCustomer(): Customer
{
return $this->customer;
}
public function setCustomer(Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getNotificationTemplate(): NotificationTemplate
{
return $this->notification_template;
}
public function setNotificationTemplate(NotificationTemplate $notification_template): self
{
$this->notification_template = $notification_template;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getMessage(): string
{
return $this->message;
}
public function setMessage(string $message): self
{
$this->message = $message;
return $this;
}
public function getRelatedItemId(): ?string
{
return $this->related_item_id;
}
public function setRelatedItemId(?string $related_item_id): self
{
$this->related_item_id = $related_item_id;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getRelatedItem(): ?array
{
return $this->related_item;
}
public function setRelatedItem(?array $related_item): self
{
$this->related_item = $related_item;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps(): void
{
$now = new \DateTime('now');
$this->setUpdatedAt($now);
if (null === $this->getCreatedAt()) {
$this->setCreatedAt($now);
}
}
}