This will be a multi-part demonstration for building basic search functionality using CakePHP. Part 1 focuses on searching across models that have HasAndBelongsToMany relationships. Here’s a working demo of Part 1.
You see this type of search when looking for items that share similar properties. In the demo, it’s Bars that have Features (WiFi, TV, etc), Scenes (Lounge, Afterhours, etc) and Neighborhoods (Chelsea, Soho, etc). HABTM search is also useful for searching items that share Tags, Colors, Size, Flavor and on and on.
(more…)