Instead of creating custom getter methods in your models, like we did in our previous recipe by running
find() internally and returning an array of results, you can also use the built-in feature to define custom finder methods. These can modify the find options before the query is executed or even fix the returned results before they are used.
Custom finders provide a better interface to reuse common
find operation parameters. Instead of working only with the result arrays (containing the database rows in array format), we'll be able to work with the find options first.
In this recipe, we'll create a custom finder to retrieve the latest products in our database, injecting a stored in several warehouses field on the fly, once the results ...