Skip to content

Allow for request parameter transformations #1

@corazzi

Description

@corazzi

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions