Skip to content

Commit

Permalink
fixing up the join code for using aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Oct 11, 2012
1 parent 2f8b0fc commit 53959d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Model/AppModel.php
Expand Up @@ -300,6 +300,16 @@ public function autoJoinModel($Model, $options = array()) {

$this->_joinConditions($Model, $options);

if($Model->alias !== $options['alias']) {
$conditions = array();
foreach($options['conditions'] as $k => $v) {
$k = str_replace($Model->alias, $options['alias'], $k);
$v = str_replace($Model->alias, $options['alias'], $v);
$conditions[$k] = $v;
}
$options['conditions'] = $conditions;
}

return $options;
}

Expand Down

0 comments on commit 53959d4

Please sign in to comment.