Today we finished beta support of CakePHP validators in ORM Designer. Thanks to Stefano Manfredini for giving us the idea and testing this new feature. You will find this new feature in upcoming ORM Designer 1.4.0 version build 417 and later.
Screenshot of testing model with entered validators:
Detailed screenshot to all supported validators in ORM Designer:
How to use it
If you want to add a validator to any field in your model, follow next instructions:
- Select the field where you want to define new data validation.
- In ORM Property window click on Validator item -> ”Add Item”.
- After clicking on “Add Item”, the window with all supported validators appear. Choose the required validator and press OK.
- After selecting validator from the list, you can add some additional parameters. You can do this by selecting added validator and entering value to the correspond property.
After you enter all required validators, you can “Export” them to base class.
And it’s done. No more complicated and confused array definitions, simple design it in ORM Designer ;-)
List of currently supported validators include their parameters:
All validators have folllowing commont properties:
- name: Rule name used in definition array when field has multiple validators
- required: Require flag, for more information follow CakePHP documentation.
- allowEmpty: AllowEmpty flagfor more information follow CakePHP documentation.
- on: Validator type. Can be NULL/create/update. For more information follow CakePHP documentation.
- message: Error message for the rule.For more information follow CakePHP documentation.
- last: Flag used when one field have multiple validators. More information about last flag in CakePHP documentation .