<?php
namespace App\Entity;
use App\Repository\EventRegistrationRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EventRegistrationRepository::class)]
class EventRegistration
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Event::class, inversedBy: 'registrations')]
#[ORM\JoinColumn(nullable: false)]
private $event;
#[ORM\Column(type: 'string', length: 255)]
private $firstName;
#[ORM\Column(type: 'string', length: 255)]
private $lastName;
#[ORM\Column(type: 'string', length: 255)]
private $email;
#[ORM\Column(type: 'string', length: 20, nullable: true)]
private $phone;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $companyName;
#[ORM\Column(type: 'integer')]
private $companionsCount = 0;
#[ORM\Column(type: 'boolean')]
private $optInRgpd = false;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $registrationToken;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->registrationToken = bin2hex(random_bytes(16));
}
// Getters and Setters...
public function getId(): ?int
{
return $this->id;
}
public function getEvent(): ?Event
{
return $this->event;
}
public function setEvent(?Event $event): self
{
$this->event = $event;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
public function getCompanionsCount(): ?int
{
return $this->companionsCount;
}
public function setCompanionsCount(int $companionsCount): self
{
$this->companionsCount = $companionsCount;
return $this;
}
public function isOptInRgpd(): ?bool
{
return $this->optInRgpd;
}
public function setOptInRgpd(bool $optInRgpd): self
{
$this->optInRgpd = $optInRgpd;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getRegistrationToken(): ?string
{
return $this->registrationToken;
}
public function setRegistrationToken(?string $registrationToken): self
{
$this->registrationToken = $registrationToken;
return $this;
}
}