We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon\Mvc\Model\Resultset\Simple methods current and next gives null

current(), next() and seek() method of Phalcon\Mvc\Model\Resultset\Simple object results NULL

if I use count() on same object, output is 11.

Query is build like this

$resultSet = $this->modelManager ->createBuilder() ->from(self::NAME) ->columns(array('id', 'title')) ->where('status = 1' ) ->orderBy('sort_order') ->getQuery() ->execute();

next() should not return a value it just move the internal pointer of the iterator to the next position. Same for seek()



1.4k

next() should not return a value it just move the internal pointer of the iterator to the next position. Same for seek()

Thanks Andres, I came to know that current only works after calling valid() method of resultset method.

One more weird thing I came across is if I call seek(4) and then current() it will give me first result only instead of 4th one.