[FLOW3-general] Using DQL
Pankaj Lele
pankaj at lelesys.com
Wed Nov 23 11:17:14 CET 2011
Hello Bastian,
> Please keep in mind, that you lose support for query based Fluid widgets
> when using DQL directly and that extensive use of it could be a sign of
> an over-complex domain model.
Personally I would love to stick to FLOW3 QOM to get the full support.
I try to ask precise question:
How to decide which repository to use in what scenarios? either
\TYPO3\FLOW3\Persistence\Repository or
TYPO3\FLOW3\Persistence\Doctrine\Repository
The exact problem I faced, in ProductController->indexAction i have
productRepository->findAll() and there is a pagination widget in
Index.html. In this case ProductRepository was extending
\TYPO3\FLOW3\Persistence\Repository and everything works perfectly.
I now need a ProductController->topTenAction() to show top 10 products
with doing some AVG(ranking)...GROUP BY etc.
Next, thinking to use DQL for this I switched the repository base class
to TYPO3\FLOW3\Persistence\Doctrine\Repository and still no more code in
productRepository class was added and tested the indexAction again but
this time it failed with the pagination widget "expecting a
QueryResultInterface and found an array" error.
Next to overcome this problem I decided to keep the original
ProductRepository still extends \TYPO3\FLOW3\Persistence\Repository and
created new repository class ProductRepository in NS
\Lelesys\ProductStore\Domain\Repository\Dql.
Then injected this additional repository in the ProductController and in
topTenAction() I called $this->dqlProductRepository->findTopTen() having
the DQL query in it.
So is this a complete mess or "OK" to have this kind of workaround to
have application future compatible with FLOW3? :)
Thanks,
Pankaj
--
With best regards,
Pankaj Lele
---------------------------
CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India
Web: http://www.lelesys.com
[Certified TYPO3 Integrator]
More information about the FLOW3-general
mailing list