What is the DQL equivalent of the MySQL FOUND_ROWS () method?

Is there any method or method for getting the number of results from a select query, as if it were being executed without a limit clause using DQL? Would such behavior be similar to using SQL_CALC_FOUND_ROWS and FOUND_ROWS() in MySQL?

+4
source share
1 answer

Yes it is. There is a Paginator Extension for versions of Doctrine below 2.2 . Starting with version 2.2, Doctrine sends Paginator for DQL queries out of the box.

Using non-standard database functions (such as SQL_CALC_FOUND_ROWS ) is not good practice with Doctrine (or another DBAL). Doctrine hides all database-dependent conditions from the user. Therefore, you cannot think about using SQL_CALC_FOUND_ROWS with Doctrine until it becomes part of cross-site SQL.

+3
source

Source: https://habr.com/ru/post/1396959/


All Articles