<?php
namespace App\Entity\Club1895;
use App\Entity\Address;
use App\Entity\Person;
use App\Repository\Club1895\Club1895ProfileRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints\NotBlank;
#[ORM\Entity(repositoryClass: Club1895ProfileRepository::class)]
class Club1895Profile
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\OneToOne(inversedBy: 'club1895Profile', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?Person $person = null;
#[ORM\Column(length: 255)]
#[NotBlank]
private ?string $email = null;
#[ORM\Column(length: 40, nullable: true)]
private ?string $phone = null;
#[ORM\Column(length: 255)]
#[NotBlank]
private ?string $company = null;
#[ORM\Column(length: 255)]
#[NotBlank]
private ?string $jobTitle = null;
#[ORM\Column(type: Types::SMALLINT)]
#[NotBlank]
private ?int $yearsOfExperience = null;
#[ORM\Embedded(class: Address::class)]
#[NotBlank]
private $address;
#[ORM\Column(type: Types::TEXT)]
#[NotBlank]
private ?string $presentation = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $offer = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $linkedinUrl = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $websiteUrl = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $calendarUrl = null;
#[ORM\OneToMany(mappedBy: 'profile', targetEntity: Registration::class, orphanRemoval: true)]
private Collection $registrations;
public function __construct()
{
$this->registrations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function setPerson(Person $person): self
{
$this->person = $person;
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 getCompany(): ?string
{
return $this->company;
}
public function setCompany(string $company): self
{
$this->company = $company;
return $this;
}
public function getJobTitle(): ?string
{
return $this->jobTitle;
}
public function setJobTitle(string $jobTitle): self
{
$this->jobTitle = $jobTitle;
return $this;
}
public function getYearsOfExperience(): ?int
{
return $this->yearsOfExperience;
}
public function setYearsOfExperience(int $yearsOfExperience): self
{
$this->yearsOfExperience = $yearsOfExperience;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(?Address $address)
{
$this->address = $address;
return $this;
}
public function getPresentation(): ?string
{
return $this->presentation;
}
public function setPresentation(string $presentation): self
{
$this->presentation = $presentation;
return $this;
}
public function getOffer(): ?string
{
return $this->offer;
}
public function setOffer(?string $offer): self
{
$this->offer = $offer;
return $this;
}
public function getLinkedinUrl(): ?string
{
return $this->linkedinUrl;
}
public function setLinkedinUrl(?string $linkedinUrl): self
{
$this->linkedinUrl = $linkedinUrl;
return $this;
}
public function getWebsiteUrl(): ?string
{
return $this->websiteUrl;
}
public function setWebsiteUrl(?string $websiteUrl): self
{
$this->websiteUrl = $websiteUrl;
return $this;
}
public function getCalendarUrl(): ?string
{
return $this->calendarUrl;
}
public function setCalendarUrl(?string $calendarUrl): self
{
$this->calendarUrl = $calendarUrl;
return $this;
}
/**
* @return Collection<int, Registration>
*/
public function getRegistrations(): Collection
{
return $this->registrations;
}
public function getActiveRegistration(): ?Registration
{
return $this->getRegistrations()
->filter(fn(Registration $r) => $r->getGlobalSeason()?->getIsActive())
->first() ?: null;
}
public function addRegistration(Registration $registration): self
{
if (!$this->registrations->contains($registration)) {
$this->registrations->add($registration);
$registration->setProfile($this);
}
return $this;
}
public function removeRegistration(Registration $registration): self
{
if ($this->registrations->removeElement($registration)) {
// set the owning side to null (unless already changed)
if ($registration->getProfile() === $this) {
$registration->setProfile(null);
}
}
return $this;
}
}