feat: oauth2 login via myep
This commit is contained in:
@@ -83,6 +83,19 @@ class Address
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public static function fromUserinfo(array $userinfo): static
|
||||
{
|
||||
$instance = new static();
|
||||
$instance
|
||||
->setStreet($userinfo['profile']['address']['street'] ?? null)
|
||||
->setPostCode($userinfo['profile']['address']['postcode'] ?? null)
|
||||
->setCity($userinfo['profile']['address']['city'] ?? null)
|
||||
->setCountry($userinfo['profile']['address']['country'] ?? 'DE')
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getStreet(): ?string
|
||||
{
|
||||
return $this->street;
|
||||
|
||||
@@ -65,6 +65,18 @@ class Communication
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public static function fromUserinfo(array $userinfo): static
|
||||
{
|
||||
$instance = new static();
|
||||
$instance
|
||||
->setPhone($userinfo['profile']['communication']['phone'] ?? null)
|
||||
->setMobile($userinfo['profile']['communication']['mobile'] ?? null)
|
||||
->setEmail($userinfo['profile']['communication']['email'] ?? null)
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getPhone(): ?string
|
||||
{
|
||||
return $this->phone;
|
||||
|
||||
@@ -238,6 +238,37 @@ class Teamer implements TimestampableEntityInterface, SoftDeletableEntityInterfa
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public static function fromUserinfo(array $userinfo): static
|
||||
{
|
||||
$instance = new static();
|
||||
|
||||
$instance
|
||||
->setAcademicTitle($userinfo['profile']['title'] ?? null)
|
||||
->setSalutation($userinfo['profile']['salutation'] ?? null)
|
||||
->setFirstName($userinfo['profile']['first_name'] ?? null)
|
||||
->setLastName($userinfo['profile']['last_name'] ?? null)
|
||||
->setGender($userinfo['profile']['gender'] ?? null)
|
||||
;
|
||||
|
||||
if (null !== $userinfo['profile']['date_of_birth'] ?? null) {
|
||||
try {
|
||||
$dateOfBirth = new \DateTimeImmutable(['profile']['date_of_birth']);
|
||||
$instance->setDateOfBirth($dateOfBirth);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$address = Address::fromUserinfo($userinfo);
|
||||
$communication = Communication::fromUserinfo($userinfo);
|
||||
|
||||
$instance
|
||||
->setAddress($address)
|
||||
->setCommunication($communication)
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
||||
Reference in New Issue
Block a user