[TYPO3-mvc] Object = 3 queries; after toArray() = 1 query

Stefan Frömken firma at sfroemken.de
Wed Aug 31 10:25:30 CEST 2011


I have another idea:

I have one template which calls a partial and this partial calls another 
partial. All three Templates/Partials works with the data of the array 
containing my 3 objects.

Maybe always the SAME query was executed with each new template/partial.

Stefan


Am 31.08.2011 10:12, schrieb Bastian Waidelich:
> 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