php – Find where heavy query is generated


Good morning I need to find where in CakePHP 2.5.2 this query is performed:

SELECT COUNT(*) AS count FROM umatabela WHERE status = 1

There is a model where this table is referenced, and it may be referenced elsewhere.

By Debugkit I'm running all possible locations and I can't find it.

Is there a better way to track than looking for models or running each script and looking in the debugkit?


It can be in several places but, by default, they would be in the model with a similar name to the table, usually in the singular.

A common call that could generate this sql would be:

$this->find("count") .


$UmaTabela->find('count') .

The cake ORM converts find() methods into query's.

If you search the project find('count') or find("count") will find it.

If you have a debugger, just track the stack trace and see the methods that were called.

Where 1=1 is added for safety when there are no search conditions, sql injection prevention.

Scroll to Top