<?php
namespace App\Entity\LearningCourses;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Garages\Garage;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\Traits\GarageTrait;
use App\Entity\Traits\LearningCourseTrait;
use App\Entity\Traits\SiteTrait;
use App\Repository\LearningCourses\LearningCourseRegistrationRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="vulco_learning_course_registration", indexes={@ORM\Index(name="learning_course_registration_site_idx", columns={"site"})})
*
* @ORM\Entity(repositoryClass=LearningCourseRegistrationRepository::class)
*
* @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
*
* @SiteAware(siteFieldName="site")
*/
class LearningCourseRegistration extends AbstractBase implements SiteInterface
{
use GarageTrait;
use LearningCourseTrait;
use SiteTrait;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Garages\Garage")
*/
private ?Garage $garage = null;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
*/
private UserInterface $associatedUser;
/**
* @ORM\ManyToOne(targetEntity="LearningCourse", inversedBy="registrations")
*/
private LearningCourse $course;
/**
* @ORM\ManyToOne(targetEntity="LearningCourseSession", inversedBy="registrations")
*/
private ?LearningCourseSession $session = null;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private string $firstName;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private string $surnames;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $legalIdNumber = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\Regex(pattern="/[[:space:]]|@/", match=false)
*/
private ?string $usernameEmailNotification = null;
public function getCreatedAtString(): string
{
return $this->getDateTimeAsString($this->getCreatedAt());
}
public function getAssociatedUser(): UserInterface
{
return $this->associatedUser;
}
public function setAssociatedUser(UserInterface $associatedUser): self
{
$this->associatedUser = $associatedUser;
return $this;
}
public function getFirstName(): string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getSurnames(): string
{
return $this->surnames;
}
public function setSurnames(string $surnames): self
{
$this->surnames = $surnames;
return $this;
}
public function getLegalIdNumber(): ?string
{
return $this->legalIdNumber;
}
public function setLegalIdNumber(?string $legalIdNumber): self
{
$this->legalIdNumber = $legalIdNumber;
return $this;
}
public function getUsernameEmailNotification(): ?string
{
return $this->usernameEmailNotification;
}
public function setUsernameEmailNotification(?string $usernameEmailNotification): self
{
$this->usernameEmailNotification = $usernameEmailNotification;
return $this;
}
public function getName(): string
{
return $this->getFirstName().' '.$this->getSurnames();
}
public function getGarageCode(): string
{
return $this->getGarage() ? $this->getGarage()->getCode() : '';
}
public function getGarageName(): string
{
return $this->getGarage() ? $this->getGarage()->getName() : $this->getName();
}
public function getSession(): ?LearningCourseSession
{
return $this->session;
}
public function setSession(?LearningCourseSession $session): self
{
$this->session = $session;
return $this;
}
public function getLearningCourseSession(): ?LearningCourseSession
{
return $this->getSession();
}
public function setLearningCourseSession(?LearningCourseSession $session): self
{
return $this->setSession($session);
}
}