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

Michael Knoll mimi at kaktusteam.de
Thu Aug 19 13:34:58 CEST 2010


Franz Koch schrieb:
> Hey,
> 
>> I would like to do a query like
>>
>>
>> SELECT group.name, count(*) as row_count FROM users
>> JOIN group ON users.group_id = group.id
>> GROUP BY group.id
>>
>> (might not be syntactically correct, but I hope you get the idea).
>>
>> Is there any possibility to do that with extbase query object?
> 
> It should be, but not for repositories if you intend to do that. If you 
> like to use this query in a repository to get mapped objects back you 
> need to call this query via a custom statement which is also possible.
> 
> $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!

Thanks a lot!

Greez

Mimi


More information about the TYPO3-project-typo3v4mvc mailing list