Php 如何检查Zend select是否返回结果

Php 如何检查Zend select是否返回结果,php,database,zend-framework,Php,Database,Zend Framework,在Zend framework中,如何检查Zend\u db\u select是否返回结果 $result = $this->fetchAll(); 是否有更好的方法而不是使用: if(count($result) != 0){ //result found! } 我喜欢使用经典: //most of these queries return either an object (Rowset or Row) or FALSE if (!$result){

在Zend framework中,如何检查
Zend\u db\u select
是否返回结果

$result = $this->fetchAll();
是否有更好的方法而不是使用:

if(count($result) != 0){
    //result found!
}

我喜欢使用经典:

   //most of these queries return either an object (Rowset or Row) or FALSE 
   if (!$result){
        //do some stuff
    } else {
        return $result;
    }

该方法返回NULL,而不是FALSE。使用if条件检查此值。

我找到了这种方法,对我来说效果很好:

if($result->count() > 0) {
    //Do something
}

谢谢你

你在这里展示的方法有什么问题?我正在寻找更好的方法。
if($result->count() > 0) {
    //Do something
}