mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
move validation on person into annotations
This commit is contained in:
@@ -62,18 +62,18 @@ services:
|
||||
- { name: security.voter }
|
||||
- { name: chill.role }
|
||||
|
||||
chill.person.birthdate_validation:
|
||||
class: Chill\PersonBundle\Validator\Constraints\BirthdateValidator
|
||||
Chill\PersonBundle\Validator\Constraints\:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
resource: '../Validator/Constraints/'
|
||||
|
||||
# override default config, must be loaded after resource
|
||||
Chill\PersonBundle\Validator\Constraints\BirthdateValidator:
|
||||
arguments:
|
||||
- "%chill_person.validation.birtdate_not_before%"
|
||||
tags:
|
||||
- { name: validator.constraint_validator, alias: birthdate_not_before }
|
||||
|
||||
Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequentialValidator:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: validator.constraint_validator }
|
||||
|
||||
Chill\PersonBundle\Repository\:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
@@ -1,70 +1,3 @@
|
||||
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 ]
|
||||
otherPhoneNumbers:
|
||||
- Valid:
|
||||
traverse: true
|
||||
constraints:
|
||||
- Callback:
|
||||
callback: isAccompanyingPeriodValid
|
||||
groups: [accompanying_period_consistent]
|
||||
- Callback:
|
||||
callback: isAddressesValid
|
||||
groups: [addresses_consistent]
|
||||
- Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential:
|
||||
groups: [ 'household_memberships' ]
|
||||
|
||||
|
||||
Chill\PersonBundle\Entity\AccompanyingPeriod:
|
||||
properties:
|
||||
openingDate:
|
||||
|
Reference in New Issue
Block a user