Add phonenumber to user

This commit is contained in:
2023-11-16 15:12:12 +00:00
parent ff344dbb0c
commit be57c96a2f
13 changed files with 432 additions and 1 deletions

View File

@@ -18,9 +18,11 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Selectable;
use Doctrine\ORM\Mapping as ORM;
use libphonenumber\PhoneNumber;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
/**
* User.
@@ -161,6 +163,15 @@ class User implements UserInterface, \Stringable
*/
private ?string $usernameCanonical = null;
/**
* The user's mobile phone number.
*
* @ORM\Column(type="phone_number", nullable=true)
*
* @PhonenumberConstraint()
*/
private ?PhoneNumber $phonenumber = null;
/**
* User constructor.
*/
@@ -419,6 +430,11 @@ class User implements UserInterface, \Stringable
}
}
public function getPhonenumber(): ?PhoneNumber
{
return $this->phonenumber;
}
/**
* @throws \RuntimeException if the groupCenter is not in the collection
*/
@@ -639,4 +655,11 @@ class User implements UserInterface, \Stringable
return $this;
}
public function setPhonenumber(?PhoneNumber $phonenumber): self
{
$this->phonenumber = $phonenumber;
return $this;
}
}