I have a model such as Story. It has a key that links it to author. I have the relationship and when i do.
storyHolder = Story->findByPK(id)
Returns the story, then
storyHolder ->author
returns the author object. The issue is that im getting both data sets by themselves I want them combined. Example returnObject{story{}, author{}}. I want returnObject{story{author{}}}
Sorry if the question is unclear,
It looks like the real issue is not with story->author but with CJSON.
Following the question, in the answered questions comment is a link to a chat, in the chat is a link to this forum post.
http://www.yiiframework.com/forum/index.php/topic/12952-cjsonencode-for-an-ar-object-does-not-include-its-related-objects/
I ended putting this in my controller
Code taken from benjaminbytheway from the Yii forums.
Just attempts to clear up the issue it appears when using CJSON in your view it doesn’t include relationship objects.