开发者

Kohana ORM Result - How to display?

开发者 https://www.devze.com 2023-02-11 13:28 出处:网络
Maybe something really simple, I got really big problem with... ORM result. I\'m loading object with relation using with(). It generates following query:

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

精彩评论

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