makerlabs/PagerBundle

How to handle queries from the user defined repository

Closed this issue · 3 comments

I have a question concerning the bundle.
Since the DoctrineOrmAdapter accept by the constructor a QueryBuilder object! Since sometimes the user defines a customized Entity repository class in order to define specialized queries, how the function of the repository can be called instead of using the standard query provided with QueryBuilder?

It wont...
You must divide your custom repository class methods into two parts:

  • a QueryBuilder method which will provide the necessary criteria for pager adapter
  • and the find method which will use the QueryBuilder method to fetch your objects

Thank you for your answer. But using the QueryBuilder inside the repository will not slow down the application?

With opcode caching enabled this isn't any of your concern. The biggest performance problems are always too many file operations and not optimized MySQL queries.