From d92be5891f8a88637271915876519b29d2be0464 Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Thu, 8 Jan 2015 18:25:04 +0100 Subject: [PATCH] Minor doc tweaks --- README.md | 2 +- doc/custom_constraints.md | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4a926b9..bdfd8eb 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ This bundle is under the MIT license. About ----- -This bundle is created and maintained by Warnar Boekkooi. +This bundle is created and maintained by [Warnar Boekkooi](http://boekkooi.net/). Special thanks go to the [Symfony](http://symfony.com/) community and [Jörn Zaefferer](http://jqueryvalidation.org/). Alternatives diff --git a/doc/custom_constraints.md b/doc/custom_constraints.md index 89a2e95..72cbd71 100644 --- a/doc/custom_constraints.md +++ b/doc/custom_constraints.md @@ -5,15 +5,12 @@ So you probably have a few custom constraints with you application and you want For this you will need to do a few things: - Create a constraint mapper - Add you constraint mapper to the DI +- Implement the constraint as a jquery validate rule The goal of a constraint mapper is to map a constraint as a jquery validation rule. In general all constraints are mapped and registered as constraint mappers. So look the constraint mappers available (under `src/Form/Rule/Mapping`) within the project and create your own. - **REMARK** - Some times you need to do more then just a map a simple constraint for this there are form passes. - These are located under `src/Form/Rule/Compiler` - Once you have create your custom constraint mapper you need to register it in the DI/Service Container. A example is: ```YAML @@ -21,4 +18,12 @@ acme.form.rule.my_mapper: class: Acme\Form\Rule\MyRule tags: - { name: validator.rule_mapper } -``` \ No newline at end of file +``` + +After this you need to make sure you include your jquery validate rule into the page. + +DataTransformer Rules/Constraints +------------- +In some cases you maybe using a custom 'DataTransformer' that validates your data (or throw a exception when it's invalid). +If this is the case you (probably) need to implement a FormRuleProcessor to add a TransformerRule. +A good example is `src/Form/Rule/Processor/DateTimeToArrayTransformerPass`.