开发者

Kohana ORM Result - How to display?

Maybe something really simple, I got really big problem with... ORM result.

I'm loading object with relation using with(). It generates following query:

SELECT `article`.`id` AS `article:id`, `article`.`name` AS `article:name`

Now's my question... how to display开发者_JS百科 article name in the view? Sorry for dumb question, I really can't beliebe I'm asking it.

Edit

Here's my code:

$activity = $user->activity->with('article')->where('article.status', '=', 1)->find_all()->as_array();

Relations are correct for sure. I can swear I saw something similar today morning on the Kohana Forums however cannot find it.

Cheers!


I haven't tested it but does it work if you do this:

$activities = $user->activity->with('article')->where('article.status', '=', 1)->find_all();
foreach($activities as $activity) {
  echo $activity->name.'<br />';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜