Getting the relating posts using CActiveRecord::model()->with(...)->findByPk(..)

Hi! I can't find in the docs how to get the related data using CActiveRecord.

Objects::model()->


with(array('flags','resources','resources.resourcetypes','categories','comments'))->


findbyPk($id!==null ? $id : $_GET['id']);

For example, what should I do to get the "flags" so they could be printed out.

Assuming the result is $object, you can access the related objects via $object->flags.

;)