[TYPO3-mvc] Possible misunderstanding of repository / variable scope?

Andreas Kiessling kiessling at pluspol.info
Fri Jun 21 11:43:17 CEST 2013


Hi,

> 
> A last question: Does it mean when having several findAll()'s on a
> single page request, the second+ findAll() doesn't fetch the DB at all
> but just gets all instances from cache, or does it fetch the DB + "join"
> the result with the instances in cache?

AFAIR, it executes the query and then checks the result. But i have not
had a look at this part for quite some time. The query also depends on
default query settings or the configured storage page. So two plugins
from the same type can get different results for a findAll query.

> 
>> When the persistence manager saves the models back to the db but there
>> are multiple instances of ONE record: how should it know, which one
>> "wins" and thus will be persisted last?
>>
>> If you don't need the model/query result, you could use the result as an
>> array http://forge.typo3.org/projects/typo3v4-mvc/wiki/QueryResult
> 
> So $query->execute()->toArray() really gets all items from the DB and
> doesn't compare / join anything with the cache? It that right?

Good question, i don't know. Perfect time to start your debugger ;)

> 
>> or you can clone the objects before modifying them.  But beware of any
>> attached records: they will reference the same objects, if you don't
>> clone them too. Is there no other way to achieve what you want?
> 
> Hmm, maybe i've got an idea: Instead of using one not persistable
> property in my model (currently used for 2 different logical things), i
> could better use two different not persistable properties. That would
> avoid interfering each other and might be a cleaner solution...
> 

Indeed :)

Regards,
Andreas



More information about the TYPO3-project-typo3v4mvc mailing list