Lithium: We can see the query executed as shown in CakePHP
P粉757640504
P粉757640504 2024-03-26 11:49:58
0
2
348

Do you know of any way to display queries executed in Lithium like in CakePHP? It might be easier for me to find the implementation. The executed query is displayed at the bottom of the page.

![Screenshot]http://imgur.com/ffNfQ

After receiving the answer, I added the code to my controller:

Volumes::applyFilter('find', function($self, $params, $chain) {
      echo '<pre>===== self ======<br>';
      var_dump($self);
      echo '===== params ======<br>';
      var_dump($params);
      echo '===== chain ======<br>';
      var_dump($chain);
      echo '</pre>';
      $next = $chain->next($self, $params, $chain);

      return $next;

});

It gives me the output of all var_dump regarding self and params but I need to execute the SQL query.

Please see the screenshot http://imgur.com/ffNfQ

P粉757640504
P粉757640504

reply all(2)
P粉052724364

As @Nils suggested, you can leverage Lithium filters and write a simple query logger.
Imade one here. It logs the read query to a file in the product environment.
You should be able to customize and add filters to the create, update, and delete actions to suit your needs.

If you are looking for an out-of-the-box solution, such as Cake's debug toolbar, check out the li3_perf project: https://github.com/tmaiaroto/li3_perf

P粉322918729

Following all the suggestions from Nils and Mehdi, I created a new plugin that only displays query results and not vardump or print_r() of queries executed in Lithium using MongoDB.

Now it's really easier for me to find what it's doing.

You can view the project on Github:

https://github.com/nilamdoc/li3_show

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!