Skip to content

Commit

Permalink
fixing parameters for commentable behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Aug 26, 2009
1 parent 2be3423 commit 1d9f922
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions models/behaviors/commentable.php
Expand Up @@ -89,20 +89,20 @@ function createComment(&$model, $commentData = array()){
}

function getComments(&$model, $parameters = array()){
$parameters = array_merge(array('id', 'options'), $parameters);

if (isset($parameters['id']) && !is_numeric($parameters['id'])) {
$parameters = array_merge(array('id' => $model->id, 'options' => array()), $parameters);
$options = array();
if (isset($parameters['id']) && is_numeric($parameters['id'])) {
$options = array_merge_recursive(
array('conditions' => array("$this->__settings[$model->alias]['class'].$this->__settings[$model->alias]['foreign_key']" => $parameters['id'])),
array('conditions' => array("{$this->__settings[$model->alias]['class']}.{$this->__settings[$model->alias]['foreign_key']}" => $parameters['id'])),
$parameters['options']
);
}
if (isset($options) && !$this->__checkForEmptyVal($options)){
$model->Comment->find('all',
return $model->Comment->find('all',
$options
);
} else {
$model->Comment->find('all');
return $model->Comment->find('all');
}
}

Expand Down

0 comments on commit 1d9f922

Please sign in to comment.