title: YII CActiveDataProvider with relational tables
body: <p>I have three tables:</p>
  
  <ul>
  <li>Content (id)</li>
  <li>ContentCategory (id_content, id_category)</li>
  <li>Category (id)</li>
  </ul>
  
  <p>Relations of Content,</p>
  
  <pre><code>'Categories' =&gt; array(self::MANY_MANY, 'Category', 'ContentCategory(id_content, id_category)'),
  'category' =&gt; array(self::HAS_MANY, 'Category', 'id'),
  </code></pre>
  
  <p>I need to fetch all the records of Content that have some specific Category (in a CActiveDataProvider to use in CListView).</p>
  
  <p>When I use the findAll(), I get the records I want (it works),</p>
  
  <pre><code>$model=Content::model()-&gt;with(array(
  'Categorieses'=&gt;array(
      'condition'=&gt;'id_category=1',
  ),
  ))-&gt;findAll();
  </code></pre>
  
  <p>But when I do with CActiveDataProvider I get all the records in Content (not the ones that have specific Category - Not works)</p>
  
  <pre><code>$dataProvider=new CActiveDataProvider('Content',
          array(
                  'pagination'=&gt;array('pageSize'=&gt;15),
                  'criteria'=&gt;array(
                      'with'=&gt;array(
                          'Categories'=&gt;array(
                              'condition'=&gt;'id_category=1',
                          ),
                      ),
                  ),
              )
          );
  </code></pre>
  
  <p>How can I do that?</p>
  
  <p>Thanks a lot!</p>