chanmix51 / PommBundle

The Symfony2 bundle for Postgresql Object Model Manager
30 stars 10 forks source link

Profiler always 0 #26

Closed belka-ew closed 9 years ago

belka-ew commented 9 years ago

Web profiler doesn't work for me. I see the Pomm icon on the profiler panel, but it display always: DB Queries: 0 Query time 0.00 ms

But I have DB queries on the page I'm talking about. It's Symfony 2.6.4 with Smarty as template engine (if it matters). I really don't know, what information I should provide, so you can debug it. Just ask and I'll provide everything you need.

chanmix51 commented 9 years ago

I will have a look at it soon but for now we are focusing at Pomm2. Its bundle is working so if you could use Pomm2 you should have no problem.

belka-ew commented 9 years ago

Hey,

I've found what was the problem. It was the documentation :). I used the examples from the bundle documentation to get the database connection in a controller (https://github.com/chanmix51/PommBundle). All 3 examples use:

   $things = $this->get('pomm')
        ->getDatabase()
        ->createConnection()

After I had replaced createConnection() with getConnection(), the profiler started to work. As I read later in the Pomm documentation, createConnection() forces to create a new database connections and it resets the query counter.

I tried Pomm2 aswell but couldn't quickly get it working. I need only basic functions, but unfortunately I have no time to search for bugs if something doesn't work, therefore I've chosen Pomm1. And as I've seen, there's not much documentation for Pomm2 and Pomm2 differs from the Pomm1 and missing documentation is a problem for me aswell to begin to use a new bundle. Maybe I give it one try more, so I shouldn't port everything to Pomm2 later.

Anyway, you're doing great job, I appreciate it, I like the idea of this bundle and I'll use it anyway in all my projects (I already integrated Pomm in 2 of my projects) instead of doctrine. I wish you luck with your project and will see if and how I can help.Thanks!

chanmix51 commented 9 years ago

Thank you for the kind feedback. I have corrected the README.

Pomm2 does not have a user oriented documentation for now because it is still in beta and things can change. However the README files and the few pages about it on the site are merely complete. The symfony support is by far better, exposing formatted queries, the ability to explain them and the timeline.

We are really interested by what made your experience with Pomm2 hard so we will be able to write a comprehensive guide for beginner lately.

belka-ew commented 9 years ago

thaks for your response. Where can I bore you? Should I create a ticket on pomm-project for each issue I have, one ticket for all "start up" issues or just write here? Can I ask questions If I don't understand something related to Pomm/PommBundle?

The first small problem is that I should add pomm-symfony-bridge ("Normally it should not be installed manually since it is required by either the pomm-project/pomm-profiler-service-provider (Silex) or the pomm-project/pomm-bundle (Symfony).") manually into composer.json. Otherwise I get:

  Problem 1
    - Installation request for pomm-project/pomm-bundle 2.0.*@dev -> satisfiable by pomm-project/pomm-bundle[2.0.x-dev].
    - pomm-project/pomm-bundle 2.0.x-dev requires pomm-project/pomm-symfony-bridge ~2.0@dev -> no matching package found.
  Problem 2
    - pomm-project/pomm-bundle 2.0.x-dev requires pomm-project/pomm-symfony-bridge ~2.0@dev -> no matching package found.
    - symfony/framework-standard-edition 2.6.x-dev requires pomm-project/pomm-bundle 2.0.*@dev -> satisfiable by pomm-project/pomm-bundle[2.0.x-dev].
    - Installation request for symfony/framework-standard-edition 2.6.x-dev -> satisfiable by symfony/framework-standard-edition[2.6.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

"minimum-stability" didn't fix the problem. My requrie section now (with the symfony bridge, this configuration works, I get the error, before if I remove pomm-symfony-bridget line):

    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.6.*",
        "pomm-project/cli": "2.0.*@dev",
        "pomm-project/model-manager": "2.0.*@dev",
        "pomm-project/foundation": "2.0.*@dev",
        "pomm-project/pomm-symfony-bridge": "~2.0@dev",
        "pomm-project/pomm-bundle": "2.0.*@dev",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0",
        "sensio/framework-extra-bundle": "~3.0",
        "noiselabs/smarty-bundle": "dev-form-extension"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3",
        "phpunit/phpunit": "4.3.*"
    },

Ok second method to fix this, is to add:

    "minimum-stability": "dev",
    "prefer-stable" : true,

into composer.json. Maybe it is just a development time issue. Just a notice by me.