mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-22 18:24:23 +00:00
Use PhoneNumber form type.
This commit is contained in:
parent
47676c67ff
commit
dbbbd99788
@ -37,6 +37,7 @@ use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Exception;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
@ -371,12 +372,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* The person's mobile phone number.
|
||||
*
|
||||
* @ORM\Column(type="text")
|
||||
* @PhonenumberConstraint(
|
||||
* type="mobile",
|
||||
* )
|
||||
* @ORM\Column(type="phone_number")
|
||||
*/
|
||||
private string $mobilenumber = '';
|
||||
private ?PhoneNumber $mobilenumber;
|
||||
|
||||
/**
|
||||
* The person's nationality.
|
||||
@ -426,12 +424,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* The person's phonenumber.
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
* @PhonenumberConstraint(
|
||||
* type="landline",
|
||||
* )
|
||||
* @ORM\Column(type="phone_number")
|
||||
*/
|
||||
private ?string $phonenumber = null;
|
||||
private ?PhoneNumber $phonenumber;
|
||||
|
||||
/**
|
||||
* The person's place of birth.
|
||||
|
@ -31,8 +31,9 @@ use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberType as LibphonenumberPhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@ -41,7 +42,6 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@ -141,14 +141,16 @@ class PersonType extends AbstractType
|
||||
$examplePhoneNumber = PhoneNumberUtil::getInstance()
|
||||
->getExampleNumberForType(
|
||||
$this->parameterBag->get('chill_main.phone_helper')['default_carrier_code'],
|
||||
PhoneNumberType::FIXED_LINE
|
||||
LibphonenumberPhoneNumberType::FIXED_LINE
|
||||
);
|
||||
|
||||
$builder
|
||||
->add(
|
||||
'phonenumber',
|
||||
TelType::class,
|
||||
PhoneNumberType::class,
|
||||
[
|
||||
'default_region' => $this->parameterBag->get('chill_main.phone_helper')['default_carrier_code'],
|
||||
'format' => PhoneNumberFormat::NATIONAL,
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'placeholder' => PhoneNumberUtil::getInstance()->format($examplePhoneNumber, PhoneNumberFormat::NATIONAL)
|
||||
@ -161,14 +163,16 @@ class PersonType extends AbstractType
|
||||
$examplePhoneNumber = PhoneNumberUtil::getInstance()
|
||||
->getExampleNumberForType(
|
||||
$this->parameterBag->get('chill_main.phone_helper')['default_carrier_code'],
|
||||
PhoneNumberType::MOBILE
|
||||
LibphonenumberPhoneNumberType::MOBILE
|
||||
);
|
||||
|
||||
$builder
|
||||
->add(
|
||||
'mobilenumber',
|
||||
TelType::class,
|
||||
PhoneNumberType::class,
|
||||
[
|
||||
'default_region' => $this->parameterBag->get('chill_main.phone_helper')['default_carrier_code'],
|
||||
'format' => PhoneNumberFormat::NATIONAL,
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'placeholder' => PhoneNumberUtil::getInstance()->format($examplePhoneNumber, PhoneNumberFormat::NATIONAL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user