【发布时间】:2013-06-10 15:05:24
【问题描述】:
为了向用户显示消息,检查 Doctrine 查询结果是否为空或没有值的正确方法是什么?我有这个代码:
public function executeIndex(sfWebRequest $request) {
$this->sdriving_emisors = Doctrine_Core::getTable('SdrivingEmisor')->createQuery('a')->execute();
}
在我看来,我正在检查如下:
<?php if (!empty($sdriving_emisors)): ?>
// show records
<?php else: ?>
// show message
<?php endif; ?>
但不起作用,因为$sdriving_emisors 总是有内容,所以有什么帮助吗?
PS:我正在使用 Symfony 1.4.20
【问题讨论】:
标签: doctrine symfony-1.4 doctrine-1.2