2022-10-15 15:22:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use App\Repository\PatientRepository;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
#[ORM\Entity(repositoryClass: PatientRepository::class)]
|
|
|
|
class Patient
|
|
|
|
{
|
|
|
|
#[ORM\Id]
|
|
|
|
#[ORM\GeneratedValue]
|
|
|
|
#[ORM\Column]
|
|
|
|
private ?int $id = null;
|
|
|
|
|
|
|
|
#[ORM\Column(length: 100)]
|
|
|
|
private ?string $lastname = null;
|
|
|
|
|
|
|
|
#[ORM\Column(length: 100)]
|
|
|
|
private ?string $firstname = null;
|
|
|
|
|
|
|
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
|
|
|
private ?\DateTimeInterface $birthdate = null;
|
|
|
|
|
|
|
|
#[ORM\Column]
|
2022-10-15 22:24:22 +02:00
|
|
|
private ?string $donneurNumber = null;
|
2022-10-15 15:22:45 +02:00
|
|
|
|
|
|
|
#[ORM\OneToMany(mappedBy: 'donneur', targetEntity: Don::class, orphanRemoval: true)]
|
|
|
|
private Collection $dons;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->dons = new ArrayCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getId(): ?int
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLastname(): ?string
|
|
|
|
{
|
|
|
|
return $this->lastname;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLastname(string $lastname): self
|
|
|
|
{
|
|
|
|
$this->lastname = $lastname;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFirstname(): ?string
|
|
|
|
{
|
|
|
|
return $this->firstname;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFirstname(string $firstname): self
|
|
|
|
{
|
|
|
|
$this->firstname = $firstname;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBirthdate(): ?\DateTimeInterface
|
|
|
|
{
|
|
|
|
return $this->birthdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setBirthdate(\DateTimeInterface $birthdate): self
|
|
|
|
{
|
|
|
|
$this->birthdate = $birthdate;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2022-10-15 22:24:22 +02:00
|
|
|
public function getDonneurNumber(): ?string
|
2022-10-15 15:22:45 +02:00
|
|
|
{
|
|
|
|
return $this->donneurNumber;
|
|
|
|
}
|
|
|
|
|
2022-10-15 22:24:22 +02:00
|
|
|
public function setDonneurNumber(string $donneurNumber): self
|
2022-10-15 15:22:45 +02:00
|
|
|
{
|
|
|
|
$this->donneurNumber = $donneurNumber;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection<int, Don>
|
|
|
|
*/
|
|
|
|
public function getDons(): Collection
|
|
|
|
{
|
|
|
|
return $this->dons;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addDon(Don $don): self
|
|
|
|
{
|
|
|
|
if (!$this->dons->contains($don)) {
|
|
|
|
$this->dons->add($don);
|
|
|
|
$don->setDonneur($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeDon(Don $don): self
|
|
|
|
{
|
|
|
|
if ($this->dons->removeElement($don)) {
|
|
|
|
// set the owning side to null (unless already changed)
|
|
|
|
if ($don->getDonneur() === $this) {
|
|
|
|
$don->setDonneur(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2022-10-15 22:24:22 +02:00
|
|
|
|
2022-10-15 15:22:45 +02:00
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return $this->firstname.' '.$this->lastname;
|
|
|
|
}
|
|
|
|
}
|