Reputation: 687
I currently have a reasonably big application running on cakephp, some pages generate quite a few queries to the database. Some queries are called in current controller, but others maybe called on a function on a remote model, also while using containable behavior with many models related it's becoming quite difficult to know from where certain query came from to optimize it.
I search on the docs but there's nothing about configuring the query log, also installed the debugkit but haven't found any functionality capable of doing that.
Any hints?
Upvotes: 1
Views: 44
Reputation: 3135
Encapsulate your sql connection in a PHP class, and make your query method log extra information. Another method is to add comments to the SQL query itself "--" characters denote a comment, and manually add the current PHP file path.
Upvotes: 2