I'm currently working on a project that I came into several years after it was built. The code is mostly procedural with a few objects that act more like buckets of functions than anything else. I want to start fixing it up by consolidating the database access and external API calls into domain models.
I have the general idea down, but I don't know how to handle getting lists of my data when I have multiple filters. Having methods called
$HelpRequestMapper->getById($id) work fine, but what do I do when the user wants to do multiple filters?
Should I have methods for each possible case? Ie,
$HelpRequestMapper->getByCompanyAndUserAssignedToAndQueueAndStatusAndPriorityAndSearchString($company_id, $user_id, $queue_id, $status, $priority, $search_string) This seems like it would get unwieldy very fast and not be much better than what we have now.
Should I pass in an array/object and build a query from it using something like
$HelpRequestMapper->getMultiple($array_of_options) that does some magical query building stuff to get the data I want?
Should I do something else?