Skip to content

Commit

Permalink
fix conditions on belongsTo
Browse files Browse the repository at this point in the history
  • Loading branch information
maurozadu committed Feb 10, 2014
1 parent 4ba107e commit 598d0be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Controller/ContentsController.php
Expand Up @@ -119,7 +119,11 @@ public function view($model, $id) {
if ($indx = array_search($related_model['foreignKey'], $AssocModel->brwConfig['paginate']['fields'])) {
unset($AssocModel->brwConfig['paginate']['fields'][$indx]);
}
$filters = $this->_filterConditions($AssocModel);
$filters = Hash::merge(
$this->_filterConditions($AssocModel),
(!empty($this->Model->hasMany[$AssocModel->name]['conditions'])) ?
$this->Model->hasMany[$AssocModel->name]['conditions'] : array()
);
$this->paginate[$AssocModel->name] = Set::merge(
$AssocModel->brwConfig['paginate'],
array('conditions' => $filters),
Expand Down Expand Up @@ -739,7 +743,7 @@ public function _setFilterData($Model) {
}
}
} elseif ($type == 'integer' or $type == 'boolean' or $type == 'string' or $type == 'select') {
if (!empty($this->params['named'][$model . '.' . $field])) {
if (array_key_exists($model . '.' . $field, $this->params['named'])) {
$fieldData = $this->params['named'][$model . '.' . $field];
if ($type == 'integer' and strstr($fieldData, '.')) {
$fieldData = explode('.', $fieldData);
Expand Down
2 changes: 1 addition & 1 deletion Model/Behavior/BrwPanelBehavior.php
Expand Up @@ -833,4 +833,4 @@ public function brwSchema($Model) {
return $retSchema;
}

}
}
2 changes: 1 addition & 1 deletion Model/Behavior/BrwUploadBehavior.php
Expand Up @@ -224,4 +224,4 @@ public function resizedVersions($Model, $model, $recordId, $sizes, $category_cod
}


}
}
2 changes: 1 addition & 1 deletion Model/Behavior/BrwUserBehavior.php
Expand Up @@ -106,4 +106,4 @@ public function checkAndCreate($Model, $email, $password) {
}


}
}

0 comments on commit 598d0be

Please sign in to comment.