Permalink
Browse files

Avoid recalculating whether the relationship is a self join.

  • Loading branch information...
1 parent 86b6996 commit 422be67a0318238c424640ae89e0313564682966 @bar bar committed Dec 21, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/Cake/Model/Datasource/DboSource.php
@@ -1303,6 +1303,7 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
$modelAlias = $Model->alias;
$primaryKey = $Model->primaryKey;
+ $selfJoin = ($Model->name === $LinkModel->name);
foreach ($resultSet as &$row) {
if ($type === 'hasOne' || $type === 'belongsTo' || $type === 'hasMany') {
@@ -1325,8 +1326,6 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
}
}
- $selfJoin = ($Model->name === $LinkModel->name);
-
if (!empty($assocResultSet) && is_array($assocResultSet)) {
if ($recursive > 0) {
foreach ($LinkModel->associations() as $type1) {

0 comments on commit 422be67

Please sign in to comment.