SimpleQuery: Add method hasResult()

refs #9632
This commit is contained in:
Johannes Meyer 2015-08-03 14:49:33 +02:00
parent dbc2f98053
commit 9a0e47a3e1
3 changed files with 30 additions and 0 deletions

View File

@ -422,6 +422,16 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
return $this->hasMore;
}
/**
* Return whether this query will or has yielded any result
*
* @return bool
*/
public function hasResult()
{
return $this->iteratorPosition !== null || $this->fetchRow() !== false;
}
/**
* Set a limit count and offset to the query
*

View File

@ -367,6 +367,16 @@ class RepositoryQuery implements QueryInterface, SortRules, Iterator
return $this->query->hasMore();
}
/**
* Return whether this query will or has yielded any result
*
* @return bool
*/
public function hasResult()
{
return $this->query->hasResult();
}
/**
* Limit this query's results
*

View File

@ -433,6 +433,16 @@ abstract class DataView implements QueryInterface, SortRules, IteratorAggregate
return $this->query->hasMore();
}
/**
* Return whether this query will or has yielded any result
*
* @return bool
*/
public function hasResult()
{
return $this->query->hasResult();
}
/**
* Set a limit count and offset
*