Doctrine findBy *方法和获取数组 [英] Doctrine findBy* methods and fetch array

查看:153
本文介绍了Doctrine findBy *方法和获取数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

What is the cleanest way of using the Doctrine findBy methods but getting an array returned and not objects.

getTable( '表') - > findOneById(X);

Doctrine::getTable('Table')->findOneById(x);

这样做可以返回一个教条对象。

That works but returns a doctrine object.

我仍然希望能够使用find方法,但是我知道我不能添加

I'd still like to be able to use the find methods but I know I can't add

->fetchArray()

最后。

其他任何人都有这个问题?

Anyone else had this problem?

推荐答案

尝试使用 toArray

Doctrine::getTable('Table')->findOneById(x)->toArray();

这篇关于Doctrine findBy *方法和获取数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆