<?php
namespace App\Entity;
use App\Repository\EmailOpenEventRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EmailOpenEventRepository::class)]
#[ORM\Table(name: 'email_open_events')]
class EmailOpenEvent extends BaseEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: EmailRecipient::class, inversedBy: 'openEvents')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?EmailRecipient $recipient = null;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $openedAt;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ipHash = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $userAgent = null;
public function __construct()
{
$this->openedAt = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getRecipient(): ?EmailRecipient
{
return $this->recipient;
}
public function setRecipient(?EmailRecipient $recipient): self
{
$this->recipient = $recipient;
return $this;
}
public function getOpenedAt(): \DateTimeImmutable
{
return $this->openedAt;
}
public function setOpenedAt(\DateTimeImmutable $openedAt): self
{
$this->openedAt = $openedAt;
return $this;
}
public function getIpHash(): ?string
{
return $this->ipHash;
}
public function setIpHash(?string $ipHash): self
{
$this->ipHash = $ipHash;
return $this;
}
public function getUserAgent(): ?string
{
return $this->userAgent;
}
public function setUserAgent(?string $userAgent): self
{
$this->userAgent = $userAgent;
return $this;
}
}