PreDataProcessor and DataProcessors¶
The main services for form services are
Both implement the
AbstractDataProcessor, so the services must implement the
Every form entity is a custom class, therefore, when the form is passed to
it is encapsulated and passed in a
Every implementation of the
AbstractDataProcessor can get and set the form data from/in the original form.
Every implementation must return
dataProcessor can get/update the results of the previous
dataProcessors that are stored in
dataProcessor can set an additional error message that is displayed for the user if the process is not successful.
Besides standard Symfony validators, eZ Commerce offers additional validators.
The ZIP code validation rules are different for each country. To define the different code pattern for each ZIP code a new service is defined.
This validator validates the ZIP code based on the submitted country.
If you want to use this validator in your project, make sure that your Form contains the
The validator takes the pattern by country from the configuration, and compares it with the value in the form.
Country codes, pattern and code rules are defined in
A custom email validator extends the standard Symfony validation.
NonExistingEmailValidator checks if a user with the given email already exists.
You can set the Location where Users are contained in the following configuration:
Phone/fax number validator¶
A phone and/or fax validator verifies a valid number format. The following formats are supported:
- 0123 456 789 (spaces)
The following regex allows all combinations of 0-9,
/, if minimum and maximum length fit.
You can define the minimum and maximum length for the validator:
1 2 3
VAT number validator¶
VatNumberValidator checks if the VAT number for commercial customers inside the European Union is valid.
The VIES web-service (SOAP) of the European Commission is used.
A condition for validation is that the VAT number contains a country code.