jippi/cakephp-crud — pull request #30 by jippi (2013-07-12 21:12:11+00:00)
Title: [RFC] Search Listener

This listener is a thin wrapper around the CakeDC/Search plugin

By default it just automates all the loading of `PrgComponent` and `SearchableBehavior` as well as applying any
filters that can be found in `$this->request->query` to the paginated result set

It also offers a `scope` feature, where you can define the `query` key/value your self - and thus make some more human-readable and shorter URLs

In the example below you can access `/admin/feeds/?scope=active`, `/admin/feeds/?scope=sample` and `/admin/feeds?scope=active_sample`

`scope()` also have a 3rd argument, which is the `filterArgs` that is defined in the model. This allows for ad-hoc / permission based `filterArgs` if the developer wish to do so - either in a listener, or in a `beforeFilter`

I'm gonna implement tests once we decide on the features and structure of the listener

```php
Crud->listener('Scoped')
->scope('active', ['active' => 1])
->scope('sample', ['site_id' => 62]])
->scope('active_sample', ['active' => 1, 'deal_site_id' => 62]);

return $this->Crud->executeAction();
}
}
```