mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Add phonenumber to user
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user