feat: oauth2 login via myep
This commit is contained in:
@@ -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