<?php
namespace App\Entity;
use App\Notification\BaseNotification;
use App\Repository\NotificationCustomerSettingRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=NotificationCustomerSettingRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class NotificationCustomerSetting extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="notificationCustomerSettings")
* @ORM\JoinColumn(nullable=false)
*/
private $customer;
/**
* @ORM\Column(type="integer")
*/
private $notification_type;
/**
* @ORM\Column(type="integer")
*/
private $email;
/**
* @ORM\Column(type="integer")
*/
private $sms;
/**
* @ORM\Column(type="integer")
*/
private $profile;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updated_at;
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 getNotificationType(): ?int
{
return $this->notification_type;
}
public function setNotificationType(int $notification_type): self
{
$this->notification_type = $notification_type;
return $this;
}
public function getEmail(): ?bool
{
return $this->email;
}
public function setEmail(bool $email): self
{
$this->email = $email;
return $this;
}
public function getSms(): ?bool
{
return $this->sms;
}
public function setSms(bool $sms): self
{
$this->sms = $sms;
return $this;
}
public function getProfile(): ?bool
{
return $this->profile;
}
public function setProfile(bool $profile): self
{
$this->profile = $profile;
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;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps(): void
{
$now = new \DateTime('now');
$this->setUpdatedAt($now);
if (null === $this->getCreatedAt()) {
$this->setCreatedAt($now);
}
}
public function toArray()
{
return [
'id' => $this->getId(),
'notification_type' => $this->getNotificationType(),
'email' => [
'active' => $this->getEmail(),
],
'sms' => [
'active' => $this->getSms(),
],
'system' => [
'active' => $this->getProfile(),
],
];
}
}