limit in HAS_MANY relations and CActiveDataProvider

I have AR class called Tournament which has following relation




    public function relations()

    {

        return array(

            'top_wks_results' => array(

                self::HAS_MANY, 

                'WksResult', 

                'tournament_id',

                'order'=>'place ASC',

                'limit'=>'4',

                'with'=>'player'

            ),

        );

    }



and in controller my action index with CDataProvider looks following




$dataProvider=new CActiveDataProvider('Tournament');



When displaying tournaments I expect 4 entries returned (coming from above relation) per tournament. But this is not working.

BUT if I use following code in my controller (action index)




        $dataProvider=new CActiveDataProvider('Tournament',array(

            'criteria'=>array(

                'order'=>'date DESC',

                'with'=>array(array('top_wks_results','limit'=>'4')),

            ),

        ));



4 entries from top_wks_results is returned as well.

Why this is not working for 1st code and for 2nd it does?

Problem solved (it was my fault)

Hi, I have the same problem, how did you resolve it?