Join GitHub today
Add model validations option #640
As discussed on IRC tonight...
The existing but unused (as far as I could tell) DAO option
Only custom functions are allowed (since isInt etc wouldn't make sense in this context).
As with other custom validations, they are deemed to pass if they throw no error, or fail if an error is thrown.
Any error messages collected are added to a '_' member array of the validation result object, alongside the arrays named after any fields whose validations failed.
In this simple case an object fails validation if latitude or longitude is given, but not both. If we try to build one with an out of range latitude and no longitude,
A test is included.