Skip to content
Snippets Groups Projects
Commit 393a7d22 authored by Peter Rotich's avatar Peter Rotich
Browse files

orm: Delegate ResultSet calls to QuerySet Iterator

Allows for ability to access results without the need to call getIterator on
the QuerySet. For example - $this->members->findFirst(array(...));

This commit addresses regression issue brought about by commits 8ab4432f and
eb0ba316 -- where ResultSet processing changed based on caching mode.
parent 784184b6
No related branches found
No related tags found
No related merge requests found
...@@ -1310,6 +1310,16 @@ class QuerySet implements IteratorAggregate, ArrayAccess, Serializable, Countabl ...@@ -1310,6 +1310,16 @@ class QuerySet implements IteratorAggregate, ArrayAccess, Serializable, Countabl
unset($this->count); unset($this->count);
} }
function __call($name, $args) {
if (!is_callable(array($this->getIterator(), $name)))
throw new OrmException('Call to undefined method QuerySet::'.$name);
return $args
? call_user_func_array(array($this->getIterator(), $name), $args)
: call_user_func(array($this->getIterator(), $name));
}
// IteratorAggregate interface // IteratorAggregate interface
function getIterator($iterator=false) { function getIterator($iterator=false) {
if (!isset($this->_iterator)) { if (!isset($this->_iterator)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment