返回 Doctrine_collection null
我有一个非常简单的问题。我到处找,但什么也没找到。
我有一个这样的 Doctrine 查询:
return Doctrine_Core::getTable('something')->createQuery()->where('where clause')-
>execute();
我想检查它是否返回某些内容。就这样。如果它的内容为空,我不会做其他事情。空不起作用,isset不起作用,count不起作用。我该怎么办?
我知道这很简单,但我不知道该怎么做。
任何建议将不胜感激。
i have a very simple question. i searched for it everywhere but i didn't find anything.
i have a Doctrine query like this:
return Doctrine_Core::getTable('something')->createQuery()->where('where clause')-
>execute();
i want to check whether it returns something or not. just it. if it's content is null i don't do other stuff. empty doesn't work, isset doesn't work ,count doesn't work . what am i suppose to do?
i know it's so simple but i don't know how to do it.
any suggestions would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试以下代码:
Try the following code:
对结果数组执行
->count()
怎么样?http://groups.google.com/group/doctrine-user/browse_thread/thread/b0fe08b9b3da3e41/22e036fe4674f619?pli=1
What about executing
->count()
on result array?http://groups.google.com/group/doctrine-user/browse_thread/thread/b0fe08b9b3da3e41/22e036fe4674f619?pli=1
$obj = Doctrine_Core::getTable('something')->createQuery()->where('where 子句')->execute();
如果($obj == null)
{
}
在此处输入代码
else
{
}
$obj = Doctrine_Core::getTable('something')->createQuery()->where('where clause')->execute();
if ($obj == null)
{
}
enter code here
else
{
}