<?php
namespace App\Entity;
use App\Repository\NotificationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Overblog\GraphQLBundle\Annotation\Field;
#[ORM\Entity(repositoryClass: NotificationRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Notification extends BasicEntity
{
public const LEAKED_PWD_TYPE = 'LP';
public const IP_TYPE = 'IP';
public const SUB_DOMAIN_TYPE = 'SD';
public const VULNERABILITY_TYPE = 'VL';
public const DARK_WEB_TYPE = 'DW';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Field(name: "id", type: "int")]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
#[Field(name: "message", type: "string")]
private ?string $message = null;
#[ORM\ManyToOne(inversedBy: 'notifications')]
#[ORM\JoinColumn(nullable: false)]
#[Field(name: "domain")]
private ?Domain $domain = null;
#[ORM\Column(length: 255)]
#[Field(name: "type", type: "string")]
private ?string $type = null;
#[ORM\Column]
#[Field(name: "created_at", type: "string")]
private ?\DateTimeImmutable $createdAt = null;
public function getId(): ?int
{
return $this->id;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(string $message): static
{
$this->message = $message;
return $this;
}
public function getDomain(): ?Domain
{
return $this->domain;
}
public function setDomain(?Domain $domain): static
{
$this->domain = $domain;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
#[ORM\PrePersist()]
public function setCreatedAt(): static
{
$this->createdAt = new \DateTimeImmutable();
return $this;
}
}