Kohana ORM 结果 - 如何显示?
也许事情真的很简单,但我遇到了很大的问题... ORM 结果。
我正在使用 with() 加载具有关系的对象。它生成以下查询:
SELECT `article`.`id` AS `article:id`, `article`.`name` AS `article:name`
现在是我的问题...如何在视图中显示文章名称?抱歉问了个愚蠢的问题,我真的不敢相信我在问这个问题。
编辑
这是我的代码:
$activity = $user->activity->with('article')->where('article.status', '=', 1)->find_all()->as_array();
关系肯定是正确的。我可以发誓我今天早上在 Kohana 论坛上看到了类似的东西,但找不到它。
干杯!
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 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有测试过,但是如果你这样做的话它会起作用吗:
I haven't tested it but does it work if you do this: