Permalink
Browse files

Fixed the bug that related queries should also respect default scope.

  • Loading branch information...
1 parent 885f3c4 commit 31edbb8847dbce2701b97a34bdb11deae1cb8fd3 qiang.xue committed May 9, 2009
Showing with 4 additions and 2 deletions.
  1. +4 −2 framework/db/ar/CActiveFinder.php
@@ -246,10 +246,12 @@ private function buildJoinTree($parent,$with)
if(($relation=$parent->model->getActiveRelation($with))!==null)
{
+ $relation=clone $relation;
+ $model=CActiveRecord::model($relation->className);
+ if(($scope=$model->defaultScope())!==array())
+ $relation->mergeWith($scope);
if(isset($scopes) && !empty($scopes))
{
- $model=CActiveRecord::model($relation->className);
- $relation=clone $relation;
$scs=$model->scopes();
foreach($scopes as $scope)
{

0 comments on commit 31edbb8

Please sign in to comment.