<?php
/**
* @author Leo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace App\Entity;
use App\Entity\User;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\NotificationRepository;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
/**
* @ORM\Entity(repositoryClass=NotificationRepository::class)
* @ORM\Table(name="notification", indexes={
* @ORM\Index(name="render", columns={"render"}, flags={"fulltext"}),
* @ORM\Index(name="viewed", columns={"viewed"}),
* @ORM\Index(name="readed", columns={"readed"}),
* @ORM\Index(name="deleted", columns={"deleted"}),
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="updated_at", columns={"updated_at"})
* })
*/
class Notification
{
use TimestampableEntity;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="notifications")
* @ORM\JoinColumn(nullable=false)
*/
private User $user;
/**
* @ORM\Column(type="text")
*/
private string $object;
/**
* @ORM\Column(type="text")
*/
private string $render;
/**
* @ORM\Column(type="json")
*/
private ?array $options = [];
/**
* @ORM\Column(type="boolean", options={"default":"0"})
*/
private bool $isActivity = false;
/**
* @ORM\Column(type="boolean")
*/
private bool $viewed;
/**
* @ORM\Column(type="boolean")
*/
private bool $readed;
/**
* @ORM\Column(type="boolean")
*/
private bool $deleted;
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return User
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param User $user
* @return $this
*/
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return string
*/
public function getObject()
{
return $this->object;
}
/**
* @param string $object
* @return $this
*/
public function setObject(string $object): self
{
$this->object = $object;
return $this;
}
/**
* @return string
*/
public function getRender(): ?string
{
return $this->render;
}
/**
* @param string $render
* @return $this
*/
public function setRender(string $render): self
{
$this->render = $render;
return $this;
}
/**
* @return array
*/
public function getOptions(): array
{
return $this->options;
}
/**
* @param array $options
* @return $this
*/
public function setOptions(array $options): self
{
$this->options = $options;
return $this;
}
/**
* @return bool
*/
public function getViewed(): ?bool
{
return $this->viewed;
}
/**
* @param bool $viewed
* @return $this
*/
public function setViewed(bool $viewed): self
{
$this->viewed = $viewed;
return $this;
}
/**
* @return bool
*/
public function getReaded(): ?bool
{
return $this->readed;
}
/**
* @param bool $readed
* @return $this
*/
public function setReaded(bool $readed): self
{
$this->readed = $readed;
return $this;
}
/**
* @return bool
*/
public function getIsActivity(): ?bool
{
return $this->isActivity;
}
/**
* @param bool $isActivity
* @return $this
*/
public function setIsActivity(bool $isActivity): self
{
$this->isActivity = $isActivity;
return $this;
}
/**
* @return bool
*/
public function getDeleted(): ?bool
{
return $this->deleted;
}
/**
* @param bool $deleted
* @return $this
*/
public function setDeleted(bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
}