Source API for the «PortePlugins_Validation» class
PortePlugins_Validation
Add validation support to records by registering a new method "validate" to each record.
Public static methods
- register
-
Register the plugin with a Porte instance.
- _modelTableAfter
-
This method is not yet documented.
- validate
-
Validate the current record fields by fields according to their restrictions.
The following property keys are treated:
- not_null: Validate the presence of a value
- not_null_if: Callback condition to apply not_null rule
- min:
- min_if:
- max:
- max_if:
- one_of:
- email: Validate email pattern
- url:Validate url pattern
Note: Callback may be regular php callback as well as a method which apply to the current record instance if callback is a string and if the string match a method of the record instance.
-
- return
- An
- array if not valid or null
- _iteratorCallBefore
-
Validate the each record present in the iterator and return an array for each record which does not validate containing the array return by the validate method of the record.
-
- return
- mixed
- An array of array if not valid or null