src/Entity/LearningCourses/LearningCourseRegistration.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Entity\LearningCourses;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Garages\Garage;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\Traits\GarageTrait;
  8. use App\Entity\Traits\LearningCourseTrait;
  9. use App\Entity\Traits\SiteTrait;
  10. use App\Repository\LearningCourses\LearningCourseRegistrationRepository;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Gedmo\Mapping\Annotation as Gedmo;
  13. use Symfony\Component\Security\Core\User\UserInterface;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. /**
  16.  * @ORM\Table(name="vulco_learning_course_registration", indexes={@ORM\Index(name="learning_course_registration_site_idx", columns={"site"})})
  17.  *
  18.  * @ORM\Entity(repositoryClass=LearningCourseRegistrationRepository::class)
  19.  *
  20.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  21.  *
  22.  * @SiteAware(siteFieldName="site")
  23.  */
  24. class LearningCourseRegistration extends AbstractBase implements SiteInterface
  25. {
  26.     use GarageTrait;
  27.     use LearningCourseTrait;
  28.     use SiteTrait;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\Garages\Garage")
  31.      */
  32.     private ?Garage $garage null;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  35.      */
  36.     private UserInterface $associatedUser;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="LearningCourse", inversedBy="registrations")
  39.      */
  40.     private LearningCourse $course;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity="LearningCourseSession", inversedBy="registrations")
  43.      */
  44.     private ?LearningCourseSession $session null;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=false)
  47.      */
  48.     private string $firstName;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=false)
  51.      */
  52.     private string $surnames;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      */
  56.     private ?string $legalIdNumber null;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      *
  60.      * @Assert\Regex(pattern="/[[:space:]]|@/", match=false)
  61.      */
  62.     private ?string $usernameEmailNotification null;
  63.     public function getCreatedAtString(): string
  64.     {
  65.         return $this->getDateTimeAsString($this->getCreatedAt());
  66.     }
  67.     public function getAssociatedUser(): UserInterface
  68.     {
  69.         return $this->associatedUser;
  70.     }
  71.     public function setAssociatedUser(UserInterface $associatedUser): self
  72.     {
  73.         $this->associatedUser $associatedUser;
  74.         return $this;
  75.     }
  76.     public function getFirstName(): string
  77.     {
  78.         return $this->firstName;
  79.     }
  80.     public function setFirstName(string $firstName): self
  81.     {
  82.         $this->firstName $firstName;
  83.         return $this;
  84.     }
  85.     public function getSurnames(): string
  86.     {
  87.         return $this->surnames;
  88.     }
  89.     public function setSurnames(string $surnames): self
  90.     {
  91.         $this->surnames $surnames;
  92.         return $this;
  93.     }
  94.     public function getLegalIdNumber(): ?string
  95.     {
  96.         return $this->legalIdNumber;
  97.     }
  98.     public function setLegalIdNumber(?string $legalIdNumber): self
  99.     {
  100.         $this->legalIdNumber $legalIdNumber;
  101.         return $this;
  102.     }
  103.     public function getUsernameEmailNotification(): ?string
  104.     {
  105.         return $this->usernameEmailNotification;
  106.     }
  107.     public function setUsernameEmailNotification(?string $usernameEmailNotification): self
  108.     {
  109.         $this->usernameEmailNotification $usernameEmailNotification;
  110.         return $this;
  111.     }
  112.     public function getName(): string
  113.     {
  114.         return $this->getFirstName().' '.$this->getSurnames();
  115.     }
  116.     public function getGarageCode(): string
  117.     {
  118.         return $this->getGarage() ? $this->getGarage()->getCode() : '';
  119.     }
  120.     public function getGarageName(): string
  121.     {
  122.         return $this->getGarage() ? $this->getGarage()->getName() : $this->getName();
  123.     }
  124.     public function getSession(): ?LearningCourseSession
  125.     {
  126.         return $this->session;
  127.     }
  128.     public function setSession(?LearningCourseSession $session): self
  129.     {
  130.         $this->session $session;
  131.         return $this;
  132.     }
  133.     public function getLearningCourseSession(): ?LearningCourseSession
  134.     {
  135.         return $this->getSession();
  136.     }
  137.     public function setLearningCourseSession(?LearningCourseSession $session): self
  138.     {
  139.         return $this->setSession($session);
  140.     }
  141. }