RuleInferrer Interface
Implement theRuleInferrer interface:
Parameters
- property -
DataPropertyobject representing the property (read more) - rules -
PropertyRulescollection of previously inferred rules - context -
ValidationContextcontaining:payload- Current payload for the data object being validatedfullPayload- Full payload being validatedvalidationPath- Path from full payload to current payload
Working with PropertyRules
Adding Rules
Automatic Rule Replacement
When adding a rule of the same type, the previous version is removed:Adding String Rules
Checking for Rule Types
Removing Rules
Example Implementation
Registration
Rule inferrers must be registered in theconfig/data.php config file:
Return Value
A rule inferrer must always return a
PropertyRules collection.