[TYPO3-mvc] How to get calculated data from a query into an object?

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Feb 18 01:28:18 CET 2010


>> http://pastebin.com/m2778270a
>
> This lacks elegance ;)
>
> $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();

What, the code in general (I know it's not perfect and I'm always open 
to new things ;)) or the quoted line? Is there a shortcut to the 
dataMapper I haven't found yet?

>> As you might notice I've implemented a flag "enableResultCount". With
>> this I can count the total results and still only get a subset back in
>> one go without a second query counting the results. I implemented this
>> for pagination purposes etc. and hope it's faster then firing a second
>> query.
>
> If you don't care about DBAL you could use this Mysql feature:

well, in general I care and I'll remodel things to the correct extbase 
way once it's more feature complete. Currently I also don't use 
constraint objects, but simple arrays I pass to the repository. 
Unfortunately I'm too much in a hurry to spend any more time in 
learning/trying new concepts ATM :(

> SELECT SQL_CALC_FOUND_ROWS ....
> SELECT FOUND_ROWS()

Thanks for pointing to those methods - haven't seen them before, but I'm 
also no talented RDBM coder.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list