Feat: Implement entities for user and teamer, finalize login process

This commit is contained in:
Björn Fromme
2023-09-12 16:35:06 +02:00
parent 3739decab8
commit 35ca61d21b
27 changed files with 1008 additions and 442 deletions
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace App\Entity\Embeddable;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Embeddable]
class BankAccount
{
#[ORM\Column(nullable: true)]
private ?string $iban = null;
#[ORM\Column(nullable: true)]
private ?string $bic = null;
#[ORM\Column(nullable: true)]
private ?string $bank = null;
#[ORM\Column(nullable: true)]
private ?string $holder = null;
public function getIban(bool $obfuscated = false): ?string
{
if (false === $obfuscated) {
return $this->iban;
}
if (null === $iban = $this->getIban()) {
return '';
}
return sprintf('%s*****%s', substr($iban, 0, 6), substr($iban, -4));
}
public function setIban(?string $iban): static
{
$this->iban = $iban;
return $this;
}
public function getBic(): ?string
{
return $this->bic;
}
public function setBic(?string $bic): static
{
$this->bic = $bic;
return $this;
}
public function getBank(): ?string
{
return $this->bank;
}
public function setBank(?string $bank): static
{
$this->bank = $bank;
return $this;
}
public function getHolder(): ?string
{
return $this->holder;
}
public function setHolder(?string $holder): static
{
$this->holder = $holder;
return $this;
}
}
-149
View File
@@ -1,149 +0,0 @@
<?php
namespace App\Entity\Embeddable;
use App\BusProNet\Model\ProfileResponse;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Embeddable]
class Profile
{
#[ORM\Column]
private ?int $busProAddressId = null;
#[ORM\Column]
private ?int $busProPersonId = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(length: 255)]
private ?string $salutation = null;
#[ORM\Column(length: 255)]
private ?string $firstName = null;
#[ORM\Column(length: 255)]
private ?string $lastName = null;
#[ORM\Column(length: 1, nullable: true)]
private ?string $gender = null;
#[ORM\Column(type: 'date_immutable', nullable: true)]
private ?\DateTimeImmutable $dateOfBirth = null;
public static function fromApiResponse(ProfileResponse $profileResponse): static
{
$instance = new static();
$instance
->setBusProAddressId($profileResponse->getAddressId())
->setBusProPersonId($profileResponse->getPersonId())
->setTitle($profileResponse->getTitle())
->setSalutation($profileResponse->getSalutation())
->setFirstName($profileResponse->getFirstName())
->setLastName($profileResponse->getName())
->setGender($profileResponse->getGender())
->setDateOfBirth($profileResponse->getDateOfBirth())
;
return $instance;
}
public function getBusProAddressId(): ?int
{
return $this->busProAddressId;
}
public function setBusProAddressId(int $busProAddressId): static
{
$this->busProAddressId = $busProAddressId;
return $this;
}
public function getBusProPersonId(): ?int
{
return $this->busProPersonId;
}
public function setBusProPersonId(int $busProPersonId): static
{
$this->busProPersonId = $busProPersonId;
return $this;
}
public function getSalutation(): ?string
{
return $this->salutation;
}
public function setSalutation(?string $salutation): static
{
$this->salutation = $salutation;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): static
{
$this->title = $title;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getGender(): ?string
{
return $this->gender;
}
public function setGender(?string $gender): static
{
$this->gender = $gender;
return $this;
}
public function getDateOfBirth(): ?\DateTimeImmutable
{
return $this->dateOfBirth;
}
public function setDateOfBirth(?\DateTimeImmutable $dateOfBirth): static
{
$this->dateOfBirth = $dateOfBirth;
return $this;
}
}