Skip to content

Commit

Permalink
Minor doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Jan 8, 2015
1 parent c3b4137 commit d92be58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions doc/custom_constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ 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
acme.form.rule.my_mapper:
class: Acme\Form\Rule\MyRule
tags:
- { name: validator.rule_mapper }
```
```
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`.

0 comments on commit d92be58

Please sign in to comment.