Paginator cache dependent of Zend\Cache\Storage\Adapter\IterableInterface

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Paginator cache dependent of Zend\Cache\Storage\Adapter\IterableInterface

jmleroux
This post has NOT been accepted by the mailing list yet.
hello,

I'm starting to implement a mock cache adapter to test this Paginator PR :

https://github.com/zendframework/zf2/pull/5758


For that, i started with a very minimal cache object to test pagination, and i came across an error because of the lack of getIterator() method on my cache object.

The error came from this line :

https://github.com/zendframework/zf2/blob/master/library/Zend/Paginator/Paginator.php#L710

So it appears that Paginator has a dependency on the IterableInterface. (http://framework.zend.com/manual/2.2/en/modules/zend.cache.storage.adapter.html#the-iterableinterface)


What can be done about this ?

- check that cache object is an IterableInterface in Paginator::setCache() and throw an exception if not (must be documented) ?
- do not use cache when iterator is needed and the cache doesn't implement it ?
- other ?