Different forms may make requests with different request parameters for the same data.
For example, one form may send a parameter of minDateand another form may send a parameter of minimumDate, but both need to map to the filterMinimumDate() method.
A $transforms property could look like this:
protected $transforms = [
'minDate' => 'minimumDate'
];
The resolver will call a performTransformations() method before running each mapped filter which will set a request parameter of minimumDate to be the value of the existing request parameter minDate.
protected $map = [
'minimumDate' => 'filterMinimumDate',
]
protected $transforms = [
'minDate' => 'minimumDate',
'dateMin' => 'minimumDate',
'fromDate' => 'minimumDate',
];
Now it won't matter if the form sends minDate, dateMin, fromDate, or mimimumDate – it will always be mapped to the filterMinimumDate method.
Different forms may make requests with different request parameters for the same data.
For example, one form may send a parameter of
minDateand another form may send a parameter ofminimumDate, but both need to map to thefilterMinimumDate()method.A
$transformsproperty could look like this:The resolver will call a
performTransformations()method before running each mapped filter which will set a request parameter ofminimumDateto be the value of the existing request parameterminDate.Now it won't matter if the form sends
minDate,dateMin,fromDate, ormimimumDate– it will always be mapped to thefilterMinimumDatemethod.