add mobilenumber + validation on email and phonenumber (regex)

This commit is contained in:
nobohan
2018-05-14 12:17:33 +02:00
parent db00a0d265
commit 2f03f925ca
3 changed files with 146 additions and 108 deletions

View File

@@ -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