chill-bundles/config/validation.yaml

80 lines
3.1 KiB
YAML

Chill\PersonBundle\Entity\Person:
properties:
firstName:
- NotBlank:
groups: [general, creation]
- Length:
min: 2
max: 255
minMessage: 'This name is too short. It must containt {{ limit }} chars'
maxMessage: 'This name is too long. It must containt {{ limit }} chars'
groups: [general, creation]
lastName:
- NotBlank:
groups: [general, creation]
- Length:
min: 2
max: 255
minMessage: 'This name is too short. It must containt {{ limit }} chars'
maxMessage: 'This name is too long. It must containt {{ limit }} chars'
groups: [general, creation]
birthdate:
- Date:
message: 'Birthdate not valid'
groups: [general, creation]
- Chill\PersonBundle\Validator\Constraints\Birthdate:
groups: [general, creation]
gender:
- NotNull:
groups: [general, creation]
accompanyingPeriods:
- Valid:
traverse: true
email:
- Email:
groups: [general, creation]
message: 'The email is not valid'
checkMX: true
phonenumber:
- Regex:
pattern: '/^([\+{1}])([0-9\s*]{4,20})$/'
groups: [general, creation]
message: 'Invalid phone number: it should begin with the international prefix starting with "+", hold only digits and be smaller than 20 characters. Ex: +33123456789'
- Chill\MainBundle\Validation\Constraint\PhonenumberConstraint:
type: landline
groups: [ general, creation ]
mobilenumber:
- Regex:
pattern: '/^([\+{1}])([0-9\s*]{4,20})$/'
groups: [general, creation]
message: 'Invalid phone number: it should begin with the international prefix starting with "+", hold only digits and be smaller than 20 characters. Ex: +33623456789'
- Chill\MainBundle\Validation\Constraint\PhonenumberConstraint:
type: mobile
groups: [ general, creation ]
constraints:
- Callback:
callback: isAccompanyingPeriodValid
groups: [accompanying_period_consistent]
- Callback:
callback: isAddressesValid
groups: [addresses_consistent]
Chill\PersonBundle\Entity\AccompanyingPeriod:
properties:
openingDate:
- Date:
message: 'Opening date is not valid'
- NotNull:
message: 'Opening date can not be null'
closingDate:
- Date:
message: 'Closing date is not valid'
- NotNull:
message: 'Closing date can not be null'
groups: [closed]
constraints:
- Callback:
callback: isDateConsistent