I remember reading something similar about Symfony's Doctrine, but I can't find anything about this in Zend 2 documentation.
Here is the question explained:
Let's say that in a single controller action I call two model functions (both in same model): both functions run exactly the same TableGateway
query sets. These queries only SELECT
data. Furthermore there are no INSERT/UPDATE
operations anywhere in this action.
In this case, would Zend run the query sets twice? Or, seeing that they are duplicated and no INSERT/UPDATE
operation is done in-between, it would run the query set just once, and the second time return it from some internal cache.
ps. Just in case, please understand that I don't need general best practice advice, just the specific answer from someone who knows the depths of Zend's core.