Related Model Is Empty

My query:


$comments = Comment::model()->findAll(array(

                'condition'=>'t.id=:id and t.status=2',

                'group'=>'t.forum_id',

                'select'=>'t.id, t.status, t.forum_id, t.comment_id',

                'order'=>'t.id desc',

                'with'=>array('forum'),

                'alias'=>'t',

                'params'=>array(':id'=>$id)

            )

        );

        

        var_dump($comments->forum); exit; //Trying to get property of non-object

Comment model:


'forum' => array(self::BELONGS_TO, 'Forum', 'forum_id'),

Forum model:


'comment' => array(self::HAS_MANY, 'Comment', 'forum_id'),

Why dont use the related model?

CActiveRecord::findAll() returns an array of objects, so $comments is an array of Comments.




foreach($comments as $comment)

   var_dump($comment->forum);



Ohhh, holy ****.

Thank you, i forgot this. :(