Zend Framework Zend Db Profiler

Analyzing database SQL query’s within Zend Framework Front Controllers isn’t difficult here’s an example:

$bootstrap = $this->getFrontController()->getParam(“bootstrap”);

if ($bootstrap->hasPluginResource(“db”)) {
      $dbResource = $bootstrap->getPluginResource(“db”);
      $db = $dbResource->getDbAdapter();

$profiler = $db->getProfiler();
$profiler->setEnabled(true);

}
            foreach ($devs->getDevices($cliente->idcliente) as $equip) {

                $equip->findDependentRowset(“DM_Model_Services”, “equipment”);
    $query = $profiler->getLastQueryProfile();

    echo $query->getQuery();      

          }

My database config in application.ini:

resources.db.adapter         = pdo_mysql
resources.db.params.host     = 127.0.0.1
resources.db.params.username = user
resources.db.params.password = pass
resources.db.params.dbname   = sal_db

This will give an output like:

SELECT `service`.* FROM `service` WHERE (`idequipment` = 70)

 

php frameworks

Frameworks , Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks, Frameworks. OK, vou continuar a experimentar o symfony e deixar um pouco o uso do cakephp (apesar de me permitir uma boa estrutura e tudo o symfony parece estar mais avançado.

PS: Note to self , remember to start a new programming language.

CodeIgniter

Acaba de sair uma review a um livro no phpclasses mais um framework de PHP já conhecido mas desta vez sai o livro sobre o framework.

http://www.phpclasses.org/reviews/id/1847191746.html#review97

Com tantos frameworks de PHP por aí isto só mostra o potencial da linguagem no que toca a permitir a abstração e diferentes métodos lógicos de resolver um problema, no entanto acaba por ser uma fraqueza na minha opinião, pois
quando a oferta é muita diminui a qualidade e aumenta a confusão.

O meu comentário no site em Inglês / My comment on the website in English

There are a lot of PHP frameworks out there but has the offer grows the quality or funcionality seems to miss a bit in everyone.

At the end I still do not know witch is best and don’t have time to try all, recently I’ve been using cakephp for a few months now and still discover new things to do with it and have to go around and discover how it all works in the framework.
If a system for localization would be in place in this framework ( or other ) I would have to code around it, so it would work in with other code. Like smarty wich has a workaround for cake, yet all this solutions are still showing up, and at the end we have to insert all this in the framework and sometimes it doesn’t work that well.

The positive side is that when someone comes and picks up the code he will know how it’s structured and can pick it up right away.

Best regards,
Fernando

Engraçado, acabei de ver no site do phpclasses uma discussão sobre a introdução de namespaces ao PHP e sobre como isso irá afectar os programadores. Interessante será ver como os frameworks se irão remodelar à volta disto.