<?php
namespace App\Entity;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use App\Controller\API\UserController;
use App\Controller\API\UserHashController;
use App\Repository\UserRepository;
use App\Model\EmailMessageNotificable;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* itemOperations={"get",
* "put",
* "patch",
* "delete",
* "hash_password"= {
* "controller"=UserHashController::class,
* "method"="PATCH",
* "path"="/users/{id}/update.{_format}",
* }
*
* },
* collectionOperations= {
* "get",
* "post"= {
* "controller"=UserController::class,
* "method"="POST",
* "path"="/users.{_format}",
* }
*
* }
* )
* @ApiFilter(OrderFilter::class, properties={"id","lastName"}, arguments={"orderParameterName"="order"})
*
*
*/
class User implements UserInterface, PasswordAuthenticatedUserInterface, EmailMessageNotificable
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"read"})
*/
private $id;
/**
* @Groups({"read"})
* @ORM\Column(type="string", length=180, unique=true)
*
*/
public $email;
/**
* @Groups({"read"})
* @ORM\Column(type="json")
*
*/
private $roles = [];
/**
*
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $lastName;
/**
* @Groups({"read"})
* @ORM\Column(type="string", length=255, nullable=true)
*
*/
private $occupation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $phoneExtension;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $googleScholarLink;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $researchGateLink;
/**
* @ORM\Column(type="array", nullable=true)
* @Groups({"read"})
*/
private $customRoles = [];
/**
* @ORM\OneToMany(targetEntity=InternalEventUser::class, mappedBy="user")
*/
private $internalEvents;
/**
* @ORM\OneToMany(targetEntity=TicIssueMessage::class, mappedBy="user")
*/
private $ticIssueMessages;
/**
* @ORM\OneToMany(targetEntity=Payroll::class, mappedBy="user")
*/
private $payrolls;
/**
* @Groups({"read"})
* @ORM\Column(type="text", nullable=true)
*/
private $biography;
/**
* @Groups({"read"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $orcid;
/**
* @ORM\OneToOne(targetEntity=MediaObjectUser::class, inversedBy="user", cascade={"persist", "remove"})
* @Groups({"read"})
*/
private $mediaObjectUser;
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"read"})
*/
private $notasGerencia;
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"read"})
*/
private $descripcionPersonal;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $webPersonal;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $emailPersonal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $rpv;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $telefonoPersonal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $telefonoPersonal2;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $phoneExternal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $postalCode;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $nationality;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $bornPlace;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Groups({"read"})
*/
private $bornDate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $sexenios;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $course;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"read"})
*/
private $isAcredContratadoDoctor;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $academicGrade;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $category;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $numeroSeguridadSocial;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $dni;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $tipoDNI;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $language;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $apodo;
/**
* @ORM\Column(type="string", length=511, nullable=true)
* @Groups({"read"})
*/
private $interalNumber;
/**
* @ORM\OneToMany(targetEntity=Booking::class, mappedBy="user")
*/
private $bookings;
/**
* @ORM\OneToMany(targetEntity=NewsItemUser::class, mappedBy="user")
*/
private $newsItem;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $identifier;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read"})
*/
private $identifier2;
public function __construct()
{
$this->internalEvents = new ArrayCollection();
$this->ticIssueMessages = new ArrayCollection();
$this->payrolls = new ArrayCollection();
$this->bookings = new ArrayCollection();
$this->newsItem = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->email;
}
/**
* @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;
}
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getOccupation(): ?string
{
return $this->occupation;
}
public function setOccupation(?string $occupation): self
{
$this->occupation = $occupation;
return $this;
}
public function getPhoneExtension(): ?string
{
return $this->phoneExtension;
}
public function setPhoneExtension(?string $phoneExtension): self
{
$this->phoneExtension = $phoneExtension;
return $this;
}
public function getGoogleScholarLink(): ?string
{
return $this->googleScholarLink;
}
public function setGoogleScholarLink(?string $googleScholarLink): self
{
$this->googleScholarLink = $googleScholarLink;
return $this;
}
public function getResearchGateLink(): ?string
{
return $this->researchGateLink;
}
public function setResearchGateLink(?string $researchGateLink): self
{
$this->researchGateLink = $researchGateLink;
return $this;
}
public function getCustomRoles(): ?array
{
return $this->customRoles;
}
public function setCustomRoles(?array $customRoles): self
{
$this->customRoles = $customRoles;
return $this;
}
/**
* @return Collection<int, InternalEventUser>
*/
public function getInternalEvents(): Collection
{
return $this->internalEvents;
}
public function addInternalEvent(InternalEventUser $internalEvent): self
{
if (!$this->internalEvents->contains($internalEvent)) {
$this->internalEvents[] = $internalEvent;
$internalEvent->setUser($this);
}
return $this;
}
public function removeInternalEvent(InternalEventUser $internalEvent): self
{
if ($this->internalEvents->removeElement($internalEvent)) {
// set the owning side to null (unless already changed)
if ($internalEvent->getUser() === $this) {
$internalEvent->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, TicIssueMessage>
*/
public function getTicIssueMessages(): Collection
{
return $this->ticIssueMessages;
}
public function addTicIssueMessage(TicIssueMessage $ticIssueMessage): self
{
if (!$this->ticIssueMessages->contains($ticIssueMessage)) {
$this->ticIssueMessages[] = $ticIssueMessage;
$ticIssueMessage->setUser($this);
}
return $this;
}
public function removeTicIssueMessage(TicIssueMessage $ticIssueMessage): self
{
if ($this->ticIssueMessages->removeElement($ticIssueMessage)) {
// set the owning side to null (unless already changed)
if ($ticIssueMessage->getUser() === $this) {
$ticIssueMessage->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Payroll>
*/
public function getPayrolls(): Collection
{
return $this->payrolls;
}
public function addPayroll(Payroll $payroll): self
{
if (!$this->payrolls->contains($payroll)) {
$this->payrolls[] = $payroll;
$payroll->setUser($this);
}
return $this;
}
public function removePayroll(Payroll $payroll): self
{
if ($this->payrolls->removeElement($payroll)) {
// set the owning side to null (unless already changed)
if ($payroll->getUser() === $this) {
$payroll->setUser(null);
}
}
return $this;
}
public function getBiography(): ?string
{
return $this->biography;
}
public function setBiography(?string $biography): self
{
$this->biography = $biography;
return $this;
}
public function getOrcid(): ?string
{
return $this->orcid;
}
public function setOrcid(?string $orcid): self
{
$this->orcid = $orcid;
return $this;
}
public function getMediaObjectUser(): ?MediaObjectUser
{
return $this->mediaObjectUser;
}
public function setMediaObjectUser(?MediaObjectUser $mediaObjectUser): self
{
$this->mediaObjectUser = $mediaObjectUser;
return $this;
}
public function getNotasGerencia(): ?string
{
return $this->notasGerencia;
}
public function setNotasGerencia(?string $notasGerencia): self
{
$this->notasGerencia = $notasGerencia;
return $this;
}
public function getDescripcionPersonal(): ?string
{
return $this->descripcionPersonal;
}
public function setDescripcionPersonal(?string $descripcionPersonal): self
{
$this->descripcionPersonal = $descripcionPersonal;
return $this;
}
public function getWebPersonal(): ?string
{
return $this->webPersonal;
}
public function setWebPersonal(?string $webPersonal): self
{
$this->webPersonal = $webPersonal;
return $this;
}
public function getEmailPersonal(): ?string
{
return $this->emailPersonal;
}
public function setEmailPersonal(?string $emailPersonal): self
{
$this->emailPersonal = $emailPersonal;
return $this;
}
public function getRpv(): ?string
{
return $this->rpv;
}
public function setRpv(?string $rpv): self
{
$this->rpv = $rpv;
return $this;
}
public function getTelefonoPersonal(): ?string
{
return $this->telefonoPersonal;
}
public function setTelefonoPersonal(?string $telefonoPersonal): self
{
$this->telefonoPersonal = $telefonoPersonal;
return $this;
}
public function getTelefonoPersonal2(): ?string
{
return $this->telefonoPersonal2;
}
public function setTelefonoPersonal2(?string $telefonoPersonal2): self
{
$this->telefonoPersonal2 = $telefonoPersonal2;
return $this;
}
public function getPhoneExternal(): ?string
{
return $this->phoneExternal;
}
public function setPhoneExternal(?string $phoneExternal): self
{
$this->phoneExternal = $phoneExternal;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getNationality(): ?string
{
return $this->nationality;
}
public function setNationality(?string $nationality): self
{
$this->nationality = $nationality;
return $this;
}
public function getBornPlace(): ?string
{
return $this->bornPlace;
}
public function setBornPlace(?string $bornPlace): self
{
$this->bornPlace = $bornPlace;
return $this;
}
public function getBornDate(): ?\DateTimeInterface
{
return $this->bornDate;
}
public function setBornDate(?\DateTimeInterface $bornDate): self
{
$this->bornDate = $bornDate;
return $this;
}
public function getSexenios(): ?string
{
return $this->sexenios;
}
public function setSexenios(?string $sexenios): self
{
$this->sexenios = $sexenios;
return $this;
}
public function getCourse(): ?string
{
return $this->course;
}
public function setCourse(?string $course): self
{
$this->course = $course;
return $this;
}
public function getIsAcredContratadoDoctor(): ?bool
{
return $this->isAcredContratadoDoctor;
}
public function setIsAcredContratadoDoctor(?bool $isAcredContratadoDoctor): self
{
$this->isAcredContratadoDoctor = $isAcredContratadoDoctor;
return $this;
}
public function getAcademicGrade(): ?string
{
return $this->academicGrade;
}
public function setAcademicGrade(?string $academicGrade): self
{
$this->academicGrade = $academicGrade;
return $this;
}
public function getCategory(): ?string
{
return $this->category;
}
public function setCategory(?string $category): self
{
$this->category = $category;
return $this;
}
public function getNumeroSeguridadSocial(): ?string
{
return $this->numeroSeguridadSocial;
}
public function setNumeroSeguridadSocial(?string $numeroSeguridadSocial): self
{
$this->numeroSeguridadSocial = $numeroSeguridadSocial;
return $this;
}
public function getDni(): ?string
{
return $this->dni;
}
public function setDni(?string $dni): self
{
$this->dni = $dni;
return $this;
}
public function getTipoDNI(): ?string
{
return $this->tipoDNI;
}
public function setTipoDNI(?string $tipoDNI): self
{
$this->tipoDNI = $tipoDNI;
return $this;
}
public function getLanguage(): ?string
{
return $this->language;
}
public function setLanguage(?string $language): self
{
$this->language = $language;
return $this;
}
public function getApodo(): ?string
{
return $this->apodo;
}
public function setApodo(?string $apodo): self
{
$this->apodo = $apodo;
return $this;
}
public function getInteralNumber(): ?string
{
return $this->interalNumber;
}
public function setInteralNumber(?string $interalNumber): self
{
$this->interalNumber = $interalNumber;
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[] = $booking;
$booking->setUser($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->getUser() === $this) {
$booking->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, NewsItemUser>
*/
public function getNewsItem(): Collection
{
return $this->newsItem;
}
public function addNewsItem(NewsItemUser $newsItem): self
{
if (!$this->newsItem->contains($newsItem)) {
$this->newsItem[] = $newsItem;
$newsItem->setUser($this);
}
return $this;
}
public function removeNewsItem(NewsItemUser $newsItem): self
{
if ($this->newsItem->removeElement($newsItem)) {
// set the owning side to null (unless already changed)
if ($newsItem->getUser() === $this) {
$newsItem->setUser(null);
}
}
return $this;
}
public function getIdentifier(): ?string
{
return $this->identifier;
}
public function setIdentifier(?string $identifier): self
{
$this->identifier = $identifier;
return $this;
}
public function getIdentifier2(): ?string
{
return $this->identifier2;
}
public function setIdentifier2(?string $identifier2): self
{
$this->identifier2 = $identifier2;
return $this;
}
}