new: [blacklisting] pass parameters via named parameters to filter the index

- /eventBlacklists/index/event_uuid:[my_event_uuid]
pull/3725/head
iglocska 2018-09-16 22:06:40 +02:00
parent 57c1712e44
commit e61b7911b4
2 changed files with 12 additions and 2 deletions

View File

@ -10,8 +10,11 @@ class BlackListComponent extends Component
public $defaultModel = '';
public function index($rest = false)
public function index($rest = false, $filters = array())
{
if (!empty($filters)) {
$this->controller->paginate['conditions'] = $filters;
}
if ($this->controller->response->type() === 'application/json' || $this->controller->response->type() == 'application/xml' || $rest) {
$blackList = $this->controller->paginate();
$blacklist= array();

View File

@ -27,7 +27,14 @@ class EventBlacklistsController extends AppController
public function index()
{
$this->BlackList->index($this->_isRest());
$params = array();
$validParams = array('event_uuid', 'comment');
foreach ($validParams as $validParam) {
if (!empty($this->params['named'][$validParam])) {
$params[$validParam] = $this->params['named'][$validParam];
}
}
$this->BlackList->index($this->_isRest(), $params);
}
public function add()