<?php
namespace App\Entity\System;
use App\Repository\System\CustomerNotificationRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CustomerNotificationRepository::class)
*
* @ORM\Table(name="customer_notification")
*/
class CustomerNotification
{
/**
* @var int
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Customer
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Customer")
*
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id_customer", nullable=false)
*/
private $customer;
/**
* @var Notification
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Notification")
*
* @ORM\JoinColumn(name="notification_id", referencedColumnName="id", nullable=false)
*/
private $notification;
/**
* @var bool
*
* @ORM\Column(type="boolean", name="`read`")
*/
private $read;
/**
* @var int|null
*
* @ORM\Column(type="integer", nullable=true)
*/
private $entityId;
public static function createFromNotificationAndCustomer(Customer $customer, Notification $notification, ?int $entityId): CustomerNotification
{
$cm = new self();
$cm->customer = $customer;
$cm->notification = $notification;
$cm->entityId = $entityId;
$cm->read = false;
return $cm;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return Customer
*/
public function getCustomer(): Customer
{
return $this->customer;
}
/**
* @return Notification
*/
public function getNotification(): Notification
{
return $this->notification;
}
/**
* @return bool
*/
public function isRead(): bool
{
return $this->read;
}
/**
* @return int|null
*/
public function getEntityId(): ?int
{
return $this->entityId;
}
/**
* @param bool $read
*/
public function setRead(bool $read): void
{
$this->read = $read;
}
}