[TYPO3-mvc] Using SQL count function in ExtBase query

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Aug 20 09:35:01 CEST 2010


Hey again,

>>> $query = $this->createQuery();
>>> return $query->statement('SELECT ...')->execute();
>>>
>>>
>>> If you just like to use the QOM to build such a query (so outside of a
>>> repository) it should be possible, but I can't tell you how as I'm not
>>> too familiar with internals of the QOM layer yet.
>>
>> Hey Franz,
>>
>> thanks for your suggestion, I didn't think about that, but as I cannot
>> use domain objects to be mapped on the results, this will work fine!
>
> ok, then you can't use the suggestion above, as extbase will try to map
> the results to a domain object (except if you instantiated a custom
> QOM). In that case easiest would be to use $GLOBALS['TYPO3_DB'] just
> like before, although not the nicest way.

forget what I wrote. You can use the query object of course, but you 
have to set $query->getQuerySettings()->setReturnRawQueryResult( TRUE ) 
to tell extbase that it should not try to map the result to your domain 
model but return the raw result as array.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list