title: Reset default scope in relations, Yii 1.1
body: <p>How can I reset default scope in relations? </p>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>$matches = MatchesStat::model()
  -&gt;resetScope(true)
  -&gt;with(array('best_player', 'bad_player'))
  -&gt;findByAttributes(array(
              'match_id' =&gt; $this-&gt;id,
              'mode' =&gt; $this-&gt;mode
          ));
  </code></pre>
  
  <p><strong>Function relations():</strong></p>
  
  <pre><code>public function relations()
  {
      return array(
          'best_player'=&gt;array(self::BELONGS_TO, 'Players', '', 'on' =&gt; 't.best_pl = best_player.pl_id AND t.mode = best_player.mode', 'scopes' =&gt; array( 'resetScope' )),
          'bad_player'=&gt;array(self::BELONGS_TO, 'Players', '', 'on' =&gt; 't.bad_pl = bad_player.pl_id AND t.mode = bad_player.mode', 'scopes' =&gt; array( 'resetScope' ))
      );
  }
  </code></pre>
  
  <p><strong>Players, defaultScope:</strong></p>
  
  <pre><code>public function defaultScope()
      {
          return array(
              'condition' =&gt; $this-&gt;getTableAlias(false, false) . '.mode = "main"',
          );
      }
  </code></pre>
  
  <p>As you can see, I use 'scopes' => array( 'resetScope' ) in my relations. But:</p>
  
  <p><a href="https://i.stack.imgur.com/Kcv2q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kcv2q.jpg" alt="enter image description here"></a></p>