Commit 2f03f925 authored by Julien Minet's avatar Julien Minet

add mobilenumber + validation on email and phonenumber (regex)

parent db00a0d2
Pipeline #52081 failed with stages
in 1 minute and 33 seconds
This diff is collapsed.
......@@ -27,6 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Chill\PersonBundle\Form\Type\GenderType;
use Chill\MainBundle\Form\Type\Select2CountryType;
......@@ -80,7 +81,7 @@ class PersonType extends AbstractType
}
if ($this->config['email'] === 'visible') {
$builder->add('email', TextareaType::class, array('required' => false));
$builder->add('email', EmailType::class, array('required' => false));
}
if ($this->config['country_of_birth'] === 'visible') {
......
......@@ -30,6 +30,17 @@ Chill\PersonBundle\Entity\Person:
accompanyingPeriods:
- Valid:
traverse: true
email:
- Email:
groups: [general, creation]
message: 'The email "{{ value }}" is not a valid email.'
phonenumber:
- Regex:
pattern: '/^([\+{1}]|[0])([0-9\s*]{4,20})$/'
groups: [general, creation]
message: 'Invalid phone number: it should begin with "0" or "+", hold only digits and be smaller than 20 characters '
constraints:
- Callback:
callback: isAccompanyingPeriodValid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment