[TYPO3-mvc] Object = 3 queries; after toArray() = 1 query
Bastian Waidelich
bastian at typo3.org
Wed Aug 31 10:12:24 CEST 2011
Stefan Frömken wrote:
> When I assign these 3 records as an array of objects to fluid
> ($query->execute()), then I can see that MySQL executes the SAME Query 3
> times one after the other.
>
> When I assign these [...] as an array of arrays [...] only ONE query will be executed.
>
> Is there someone how can explain it to me?
Maybe:
If you only count the number of entries of a QueryResult, only a SELECT
COUNT.. query will be executed. Only if the entries are in memory PHP is
used to count them.
So if you have something like:
{objects -> f:count()}
<f:for each="{objects}" as="object"> ... </f:for>
Two queries will be executed. See?
Bastian
More information about the TYPO3-project-typo3v4mvc
mailing list