Skip to content

Commit

Permalink
consider conditions in relationships when showing filters
Browse files Browse the repository at this point in the history
  • Loading branch information
maurozadu committed Mar 27, 2014
1 parent c882ca9 commit 83b59be
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Controller/ContentsController.php
Expand Up @@ -119,11 +119,7 @@ public function view($model, $id) {
if ($indx = array_search($related_model['foreignKey'], $AssocModel->brwConfig['paginate']['fields'])) {
unset($AssocModel->brwConfig['paginate']['fields'][$indx]);
}
$filters = Hash::merge(
$this->_filterConditions($AssocModel),
(!empty($this->Model->hasMany[$AssocModel->name]['conditions'])) ?
$this->Model->hasMany[$AssocModel->name]['conditions'] : array()
);
$filters = $this->_filterConditions($AssocModel);
$this->paginate[$AssocModel->name] = Set::merge(
$AssocModel->brwConfig['paginate'],
array('conditions' => $filters),
Expand Down Expand Up @@ -743,7 +739,7 @@ public function _setFilterData($Model) {
}
}
} elseif ($type == 'integer' or $type == 'boolean' or $type == 'string' or $type == 'select') {
if (array_key_exists($model . '.' . $field, $this->params['named'])) {
if (!empty($this->params['named'][$model . '.' . $field])) {
$fieldData = $this->params['named'][$model . '.' . $field];
if ($type == 'integer' and strstr($fieldData, '.')) {
$fieldData = explode('.', $fieldData);
Expand Down

0 comments on commit 83b59be

Please sign in to comment.