The recipe, Searching for all items that match search terms, gives us a great starting point to create a custom find type. Custom find types allow us to extend the basic find types any model has, allowing our code to become more readable and extensible.
This recipe shows how to create a custom find type to allow the
Post model to be searched against a set of terms, thus extending the functionality shown in the previous recipe.
We need some sample models and data to work with. Follow the Getting ready section of the recipe, Performing GROUP and COUNT queries.
post.phpfile and add the
searchfind type to the list of find methods using the
_findMethodsproperty, together with the ...