<?php
namespace App\Entity;
use App\Repository\NotificationRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: NotificationRepository::class)]
class Notification
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 50)]
private $type;
#[ORM\Column(type: 'datetime')]
private $created_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $read_at;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'notifications')]
#[ORM\JoinColumn(nullable: false)]
private $user;
#[ORM\ManyToOne(targetEntity: Post::class, inversedBy: 'notifications')]
#[ORM\JoinColumn(nullable: true)]
private $post;
#[ORM\ManyToOne(targetEntity: PostComment::class)]
private $comment;
#[ORM\ManyToOne(targetEntity: User::class)]
private $initiator;
public function __construct()
{
$this->setCreatedAt(new \DateTime());
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
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 getReadAt(): ?\DateTimeInterface
{
return $this->read_at;
}
public function setReadAt(?\DateTimeInterface $read_at): self
{
$this->read_at = $read_at;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getPost(): ?Post
{
return $this->post;
}
public function setPost(?Post $post): self
{
$this->post = $post;
return $this;
}
public function getComment(): ?PostComment
{
return $this->comment;
}
public function setComment(?PostComment $comment): self
{
$this->comment = $comment;
return $this;
}
public function getInitiator(): ?User
{
return $this->initiator;
}
public function setInitiator(?User $initiator): self
{
$this->initiator = $initiator;
return $this;
}
}