<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ChildRepository")
*/
class Child
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $firstName;
/**
* @ORM\Column(type="string", length=100)
*/
private $lastName;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $birthDate;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="children")
* @ORM\JoinColumn(nullable=false)
*/
private $parent;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gender", inversedBy="children")
* @ORM\JoinColumn(nullable=false)
*/
private $gender;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SubscriptionOrder", mappedBy="participant")
*/
private $subscriptionOrders;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $forumUrl;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SessionOrder", mappedBy="participant")
*/
private $sessionOrders;
/**
* @ORM\OneToMany(targetEntity="App\Entity\VideoCoursesRegistration", mappedBy="participant")
*/
private $videoCoursesRegistrations;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TicketOrder", mappedBy="participant")
*/
private $ticketOrders;
/**
* @ORM\OneToMany(targetEntity=UserPlacementTest::class, mappedBy="participant")
*/
private $userPlacementTests;
/**
* @ORM\OneToMany(targetEntity=Exam::class, mappedBy="student")
*/
private $exams;
/**
* @ORM\OneToMany(targetEntity=TrainingReport::class, mappedBy="participant")
*/
private $trainingReports;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isChild;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isTeen;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAdult;
public function __construct()
{
$this->subscriptionOrders = new ArrayCollection();
$this->sessionOrders = new ArrayCollection();
$this->videoCoursesRegistrations = new ArrayCollection();
$this->ticketOrders = new ArrayCollection();
$this->userPlacementTests = new ArrayCollection();
$this->exams = new ArrayCollection();
$this->trainingReports = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getAge()
{
$currentDate = new \DateTimeImmutable();
$age = $currentDate->diff($this->birthDate);
return $age->y;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getFullname(){
return trim($this->getFirstname().' '.$this->getLastname());
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getBirthDate(): ?\DateTimeInterface
{
return $this->birthDate;
}
public function setBirthDate(\DateTimeInterface $birthDate): self
{
$this->birthDate = $birthDate;
return $this;
}
public function getParent(): ?User
{
return $this->parent;
}
public function setParent(?User $parent): self
{
$this->parent = $parent;
return $this;
}
public function getGender(): ?Gender
{
return $this->gender;
}
public function setGender(?Gender $gender): self
{
$this->gender = $gender;
return $this;
}
/**
* @return Collection|SubscriptionOrder[]
*/
public function getSubscriptionOrders(): Collection
{
return $this->subscriptionOrders;
}
public function addSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if (!$this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders[] = $subscriptionOrder;
$subscriptionOrder->setParticipant($this);
}
return $this;
}
public function removeSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if ($this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders->removeElement($subscriptionOrder);
// set the owning side to null (unless already changed)
if ($subscriptionOrder->getParticipant() === $this) {
$subscriptionOrder->setParticipant(null);
}
}
return $this;
}
public function __toString()
{
return $this->getFirstName();
}
public function getForumUrl(): ?string
{
return $this->forumUrl;
}
public function setForumUrl(?string $forumUrl): self
{
$this->forumUrl = $forumUrl;
return $this;
}
/**
* @return Collection|SessionOrder[]
*/
public function getSessionOrders(): Collection
{
return $this->sessionOrders;
}
public function addSessionOrder(SessionOrder $sessionOrder): self
{
if (!$this->sessionOrders->contains($sessionOrder)) {
$this->sessionOrders[] = $sessionOrder;
$sessionOrder->setParticipant($this);
}
return $this;
}
public function removeSessionOrder(SessionOrder $sessionOrder): self
{
if ($this->sessionOrders->contains($sessionOrder)) {
$this->sessionOrders->removeElement($sessionOrder);
// set the owning side to null (unless already changed)
if ($sessionOrder->getParticipant() === $this) {
$sessionOrder->setParticipant(null);
}
}
return $this;
}
/**
* @return Collection|VideoCoursesRegistration[]
*/
public function getVideoCoursesRegistrations(): Collection
{
return $this->videoCoursesRegistrations;
}
public function addVideoCoursesRegistration(VideoCoursesRegistration $videoCoursesRegistration): self
{
if (!$this->videoCoursesRegistrations->contains($videoCoursesRegistration)) {
$this->videoCoursesRegistrations[] = $videoCoursesRegistration;
$videoCoursesRegistration->setParticipant($this);
}
return $this;
}
public function removeVideoCoursesRegistration(VideoCoursesRegistration $videoCoursesRegistration): self
{
if ($this->videoCoursesRegistrations->contains($videoCoursesRegistration)) {
$this->videoCoursesRegistrations->removeElement($videoCoursesRegistration);
// set the owning side to null (unless already changed)
if ($videoCoursesRegistration->getParticipant() === $this) {
$videoCoursesRegistration->setParticipant(null);
}
}
return $this;
}
/**
* @return Collection|TicketOrder[]
*/
public function getTicketOrders(): Collection
{
return $this->ticketOrders;
}
public function addTicketOrder(TicketOrder $ticketOrder): self
{
if (!$this->ticketOrders->contains($ticketOrder)) {
$this->ticketOrders[] = $ticketOrder;
$ticketOrder->setParticipant($this);
}
return $this;
}
public function removeTicketOrder(TicketOrder $ticketOrder): self
{
if ($this->ticketOrders->contains($ticketOrder)) {
$this->ticketOrders->removeElement($ticketOrder);
// set the owning side to null (unless already changed)
if ($ticketOrder->getParticipant() === $this) {
$ticketOrder->setParticipant(null);
}
}
return $this;
}
/**
* @return Collection|UserPlacementTest[]
*/
public function getUserPlacementTests(): Collection
{
return $this->userPlacementTests;
}
public function addUserPlacementTest(UserPlacementTest $userPlacementTest): self
{
if (!$this->userPlacementTests->contains($userPlacementTest)) {
$this->userPlacementTests[] = $userPlacementTest;
$userPlacementTest->setParticipant($this);
}
return $this;
}
public function removeUserPlacementTest(UserPlacementTest $userPlacementTest): self
{
if ($this->userPlacementTests->removeElement($userPlacementTest)) {
// set the owning side to null (unless already changed)
if ($userPlacementTest->getParticipant() === $this) {
$userPlacementTest->setParticipant(null);
}
}
return $this;
}
/**
* @return Collection|Exam[]
*/
public function getExams(): Collection
{
return $this->exams;
}
public function addExam(Exam $exam): self
{
if (!$this->exams->contains($exam)) {
$this->exams[] = $exam;
$exam->setStudent($this);
}
return $this;
}
public function removeExam(Exam $exam): self
{
if ($this->exams->removeElement($exam)) {
// set the owning side to null (unless already changed)
if ($exam->getStudent() === $this) {
$exam->setStudent(null);
}
}
return $this;
}
/**
* @return Collection|TrainingReport[]
*/
public function getTrainingReports(): Collection
{
return $this->trainingReports;
}
public function addTrainingReport(TrainingReport $trainingReport): self
{
if (!$this->trainingReports->contains($trainingReport)) {
$this->trainingReports[] = $trainingReport;
$trainingReport->setParticipant($this);
}
return $this;
}
public function removeTrainingReport(TrainingReport $trainingReport): self
{
if ($this->trainingReports->removeElement($trainingReport)) {
// set the owning side to null (unless already changed)
if ($trainingReport->getParticipant() === $this) {
$trainingReport->setParticipant(null);
}
}
return $this;
}
public function getIsChild(): ?bool
{
return $this->isChild;
}
public function setIsChild(?bool $isChild): self
{
$this->isChild = $isChild;
return $this;
}
public function getIsTeen(): ?bool
{
return $this->isTeen;
}
public function setIsTeen(?bool $isTeen): self
{
$this->isTeen = $isTeen;
return $this;
}
public function getIsAdult(): ?bool
{
return $this->isAdult;
}
public function setIsAdult(?bool $isAdult): self
{
$this->isAdult = $isAdult;
return $this;
}
}