M
M
Mikhail Shatilov2019-05-19 23:58:53
symfony
Mikhail Shatilov, 2019-05-19 23:58:53

How to make an iterator for repositories?

I have DataRepositories and regular Repositories. The second takes data from the first. This was done in order to conveniently work with a third-party Rest API. As we worked with the data, we needed to select all the data in the resource. This can be done "manually" with checks for limits and shifts, or with iterators. Doctrine itself has its own iterator for Query just for such cases, but I need to implement my own. Only I don't know where. There is an idea to return from the repositories not just arrays, but a collection in which the iterate () method will be. Which will allow you to access the iterator. But so far there is no certainty that this is how it should be implemented.
There is another option with a separate iterator class that will accept the repository and work with it. Probably the best option.
How would you make an iterator?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question