WIP
This commit is contained in:
1 parent
23e66b08e8
commit
08f7836d41
21 files changed
+693
-82
No files matched your search
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Embeddable;
|
||||
|
||||
use App\BusProNet\Model\ProfileResponse;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ORM\Embeddable]
|
||||
class Communication
|
||||
{
|
||||
#[ORM\Column(type: 'string', nullable: true)]
|
||||
protected ?string $phone = null;
|
||||
|
||||
#[ORM\Column(type: 'string', nullable: true)]
|
||||
protected ?string $mobile = null;
|
||||
|
||||
#[ORM\Column(type: 'string', nullable: true)]
|
||||
#[Assert\Email(mode: 'strict')]
|
||||
protected ?string $email = null;
|
||||
|
||||
public static function fromApiResponse(ProfileResponse $profileResponse): static
|
||||
{
|
||||
$communication = $profileResponse->getCommunication();
|
||||
|
||||
$instance = new static();
|
||||
$instance
|
||||
->setPhone($communication->getPhone())
|
||||
->setMobile($communication->getMobile())
|
||||
->setEmail($communication->getEmail())
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getPhone(): ?string
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
public function setPhone(?string $phone): static
|
||||
{
|
||||
$this->phone = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMobile(): ?string
|
||||
{
|
||||
return $this->mobile;
|
||||
}
|
||||
|
||||
public function setMobile(?string $mobile): static
|
||||
{
|
||||
$this->mobile = $mobile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(?string $email): static
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user