src/Entity/Attendee.php line 20
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\AttendeeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\UX\Turbo\Attribute\Broadcast;#[ORM\Entity(repositoryClass: AttendeeRepository::class)]#[Broadcast]#[ApiResource]#[UniqueEntity(fields: ['username'], message: 'There is already an account with this username')]class Attendee implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]private ?string $username = null;#[ORM\Column]private array $roles = [];/*** @var string The hashed password*/#[ORM\Column]private ?string $password = null;#[ORM\Embedded(class: UserInformation::class)]private UserInformation $userInformation;#[ORM\Embedded(class: Adress::class)]private $billingAdress;#[ORM\ManyToOne(inversedBy: 'attendees')]private ?Corporation $corporation = null;#[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'attendees')]private Collection $courses;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: LessonProgress::class)]private Collection $lessonProgress;#[ORM\ManyToOne(inversedBy: 'attendees')]private ?Portal $portal = null;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: CourseEvaluation::class)]private Collection $courseEvaluations;#[ORM\ManyToMany(targetEntity: Badge::class, inversedBy: 'attendees')]private Collection $badges;#[ORM\Column]private ?int $mood = null;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: GivenAnswere::class)]private Collection $givenAnsweres;#[ORM\OneToMany(mappedBy: 'sender', targetEntity: Message::class)]private Collection $sendMessages;#[ORM\OneToMany(mappedBy: 'receiver', targetEntity: Message::class)]private Collection $reveivedMessages;#[ORM\Column(type: 'boolean')]private $isVerified = false;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: Booking::class)]private Collection $bookings;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: LicenseStatus::class)]private Collection $licenseStatuses;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: Certificate::class)]private Collection $certificates;#[ORM\OneToMany(mappedBy: 'attendee', targetEntity: LoggedTime::class)]private Collection $loggedTimes;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $lastLogin = null;public function __construct(){$this->userInformation = new UserInformation();$this->getUserInformation()->setCreatedAt(new \DateTimeImmutable());$this->courses = new ArrayCollection();$this->lessonProgress = new ArrayCollection();$this->courseEvaluations = new ArrayCollection();$this->badges = new ArrayCollection();$this->givenAnsweres = new ArrayCollection();$this->sendMessages = new ArrayCollection();$this->reveivedMessages = new ArrayCollection();$this->billingAdress = new Adress();$this->bookings = new ArrayCollection();$this->licenseStatuses = new ArrayCollection();$this->certificates = new ArrayCollection();$this->loggedTimes = new ArrayCollection();$this->lastLogin = new \DateTimeImmutable();}public function getEmail(): ?string{return $this->getUserInformation()->getEmail();}public function getId(): ?int{return $this->id;}public function __toString(): string{return $this->getUserInformation()->getFirstName() . ' ' . $this->getUserInformation()->getLastName();}public function getUsername(): ?string{return $this->username;}public function setUsername(string $username): self{$this->username = $username;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string)$this->username;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}/*** @see UserInterface*/public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}public function getUserInformation(): UserInformation{return $this->userInformation;}public function setUserInformation(UserInformation $userInformation): self{$this->userInformation = $userInformation;return $this;}public function getCorporation(): ?Corporation{return $this->corporation;}public function setCorporation(?Corporation $corporation): self{$this->corporation = $corporation;return $this;}/*** @return Collection<int, Course>*/public function getCourses(): Collection{return $this->courses;}public function addCourse(Course $course): self{if (!$this->courses->contains($course)) {$this->courses->add($course);$course->addAttendee($this);}return $this;}public function removeCourse(Course $course): self{if ($this->courses->removeElement($course)) {$course->removeAttendee($this);}return $this;}/*** @return Collection<int, LessonProgress>*/public function getLessonProgress(): Collection{return $this->lessonProgress;}public function addLessonProgress(LessonProgress $lessonProgress): self{if (!$this->lessonProgress->contains($lessonProgress)) {$this->lessonProgress->add($lessonProgress);$lessonProgress->setAttendee($this);}return $this;}public function removeLessonProgress(LessonProgress $lessonProgress): self{if ($this->lessonProgress->removeElement($lessonProgress)) {// set the owning side to null (unless already changed)if ($lessonProgress->getAttendee() === $this) {$lessonProgress->setAttendee(null);}}return $this;}public function getPortal(): ?Portal{return $this->portal;}public function setPortal(?Portal $portal): self{$this->portal = $portal;return $this;}/*** @return Collection<int, CourseEvaluation>*/public function getCourseEvaluations(): Collection{return $this->courseEvaluations;}public function addCourseEvaluation(CourseEvaluation $courseEvaluation): self{if (!$this->courseEvaluations->contains($courseEvaluation)) {$this->courseEvaluations->add($courseEvaluation);$courseEvaluation->setAttendee($this);}return $this;}public function removeCourseEvaluation(CourseEvaluation $courseEvaluation): self{if ($this->courseEvaluations->removeElement($courseEvaluation)) {// set the owning side to null (unless already changed)if ($courseEvaluation->getAttendee() === $this) {$courseEvaluation->setAttendee(null);}}return $this;}/*** @return Collection<int, Badge>*/public function getBadges(): Collection{return $this->badges;}public function addBadge(Badge $badge): self{if (!$this->badges->contains($badge)) {$this->badges->add($badge);}return $this;}public function removeBadge(Badge $badge): self{$this->badges->removeElement($badge);return $this;}public function getMood(): ?int{return $this->mood;}public function setMood(int $mood): self{$this->mood = $mood;return $this;}/*** @return Collection<int, GivenAnswere>*/public function getGivenAnsweres(): Collection{return $this->givenAnsweres;}public function addGivenAnswere(GivenAnswere $givenAnswere): self{if (!$this->givenAnsweres->contains($givenAnswere)) {$this->givenAnsweres->add($givenAnswere);$givenAnswere->setAttendee($this);}return $this;}public function removeGivenAnswere(GivenAnswere $givenAnswere): self{if ($this->givenAnsweres->removeElement($givenAnswere)) {// set the owning side to null (unless already changed)if ($givenAnswere->getAttendee() === $this) {$givenAnswere->setAttendee(null);}}return $this;}/*** @return Collection<int, Message>*/public function getSendMessages(): Collection{return $this->sendMessages;}public function addSendMessage(Message $sendMessage): self{if (!$this->sendMessages->contains($sendMessage)) {$this->sendMessages->add($sendMessage);$sendMessage->setSender($this);}return $this;}public function removeSendMessage(Message $sendMessage): self{if ($this->sendMessages->removeElement($sendMessage)) {// set the owning side to null (unless already changed)if ($sendMessage->getSender() === $this) {$sendMessage->setSender(null);}}return $this;}/*** @return Collection<int, Message>*/public function getReveivedMessages(): Collection{return $this->reveivedMessages;}public function addReveivedMessage(Message $reveivedMessage): self{if (!$this->reveivedMessages->contains($reveivedMessage)) {$this->reveivedMessages->add($reveivedMessage);$reveivedMessage->setReceiver($this);}return $this;}public function removeReveivedMessage(Message $reveivedMessage): self{if ($this->reveivedMessages->removeElement($reveivedMessage)) {// set the owning side to null (unless already changed)if ($reveivedMessage->getReceiver() === $this) {$reveivedMessage->setReceiver(null);}}return $this;}public function isVerified(): bool{return $this->isVerified;}public function setIsVerified(bool $isVerified): self{$this->isVerified = $isVerified;return $this;}public function getBillingAdress(): Adress{return $this->billingAdress;}public function setBillingAdress(Adress $billingadress): self{$this->billingAdress = $billingadress;return $this;}/*** @return Collection<int, Booking>*/public function getBookings(): Collection{return $this->bookings;}public function addBooking(Booking $booking): self{if (!$this->bookings->contains($booking)) {$this->bookings->add($booking);$booking->setAttendee($this);}return $this;}public function removeBooking(Booking $booking): self{if ($this->bookings->removeElement($booking)) {// set the owning side to null (unless already changed)if ($booking->getAttendee() === $this) {$booking->setAttendee(null);}}return $this;}/*** @return Collection<int, LicenseStatus>*/public function getLicenseStatuses(): Collection{return $this->licenseStatuses;}public function addLicenseStatus(LicenseStatus $licenseStatus): self{if (!$this->licenseStatuses->contains($licenseStatus)) {$this->licenseStatuses->add($licenseStatus);$licenseStatus->setAttendee($this);}return $this;}public function removeLicenseStatus(LicenseStatus $licenseStatus): self{if ($this->licenseStatuses->removeElement($licenseStatus)) {// set the owning side to null (unless already changed)if ($licenseStatus->getAttendee() === $this) {$licenseStatus->setAttendee(null);}}return $this;}/*** @return Collection<int, Certificate>*/public function getCertificates(): Collection{return $this->certificates;}public function addCertificate(Certificate $certificate): self{if (!$this->certificates->contains($certificate)) {$this->certificates->add($certificate);$certificate->setAttendee($this);}return $this;}public function removeCertificate(Certificate $certificate): self{if ($this->certificates->removeElement($certificate)) {// set the owning side to null (unless already changed)if ($certificate->getAttendee() === $this) {$certificate->setAttendee(null);}}return $this;}/*** @return Collection<int, LoggedTime>*/public function getLoggedTimes(): Collection{return $this->loggedTimes;}public function addLoggedTime(LoggedTime $loggedTime): self{if (!$this->loggedTimes->contains($loggedTime)) {$this->loggedTimes->add($loggedTime);$loggedTime->setAttendee($this);}return $this;}public function removeLoggedTime(LoggedTime $loggedTime): self{if ($this->loggedTimes->removeElement($loggedTime)) {// set the owning side to null (unless already changed)if ($loggedTime->getAttendee() === $this) {$loggedTime->setAttendee(null);}}return $this;}public function getLastLogin(): ?\DateTimeInterface{return $this->lastLogin;}public function setLastLogin(\DateTimeInterface $lastLogin): self{$this->lastLogin = $lastLogin;return $this;}}