PHP Class FilterBehavior, cakephp-filter

Inheritance: extends ModelBehavior
Show file Open project: josegonzalez/cakephp-filter

Public Methods

Method Description
beforeFind ( &$model, $queryData ) : array Adapted from work by Brenton (http://bakery.cakephp.org/articles/view/habtm-searching) New function to help with searching where conditions involve HABTM.

Method Details

beforeFind() public method

Nothing too fancy for now, just deals with first level (ex. no with), also, not sure how it'll react for multiple fields. So pretty much just best for id of a foreign key. For HABTM, association condition should not be on the join table, but association. So if: User HABTM Interests, and searching for Users, should be Interest.id. TODO: End result uses the 'IN' operator for the query, which is equivalent to 'OR', and will eventually want 'AND' instead. TODO: Test in conditions where no 'with'
public beforeFind ( &$model, $queryData ) : array
return array Modified queryData array