How to use getActiveRelation() method?

I am in the User controller with the active record loaded. With this I am trying to pull the relation from the UserExtended table/class using the getActiveRelation() method like this:


		$userExtended = $model->getActiveRelation('userExtended');

In the User model, I have the relationship defined like:


		'userExtended'=>array(self::HAS_ONE, 'UserExtended', 'uId'),

However it does not return any attributes. The corresponding record does exist so I’m unsure if I’m doing this right. var_dump() shows that the method is returning the relationship type such as ‘LEFT OUTER JOIN’ for example but no attributes.

Can anyone show me how I would achieve what I’m trying to do?

Thanks,

Dubby.

Why not access it directly?




$userExtended = $model->userExtended;



If you want to refresh a relation (reload attributes from db) after you already accessed it, you have to do getRelated(‘relationName’, true) instead.

Thank you.

That works and it’s a lot easier than what I was trying to do.