silexphp / Silex-WebProfiler

MIT License
210 stars 61 forks source link

Method "countscreams" for object "Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector" does not exist #46

Closed ghost closed 10 years ago

ghost commented 10 years ago

I am trying to use the Profiler v1.0.3 with Silex v1.2.1.

This is the error I get when trying to access a record:

Twig_Error_Runtime: Method "countscreams" for object "Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector" does not exist in "@WebProfiler/Collector/logger.html.twig" at line 5

This is how the profiler is registered:

if ($app['debug']) {
    $app->register(new Silex\Provider\ServiceControllerServiceProvider());
    $app->register(new Silex\Provider\WebProfilerServiceProvider(), array(
        'profiler.cache_dir' => __DIR__.'/../var/cache/profiler',
        'profiler.mount_prefix' => '/_profiler',
    ));
}

The TwigServiceProvider and the UrlGeneratorServiceProvider have also been registered already.

Am I doing something wrong? Or is this a general error?

danez commented 10 years ago

Which versions of symfony components are you using? How does your composer.json look like?

ghost commented 10 years ago

I am using the 2.3.* Branch. So my composer.json looks like this:

{
    "name": "foo/bar",
    "description": "foobar",
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.3.3",
        "silex/silex": "~1.0",
        "silex/web-profiler": "~1.0",
        "symfony/browser-kit": "2.3.*",
        "symfony/class-loader": "2.3.*",
        "symfony/config": "2.3.*",
        "symfony/console": "2.3.*",
        "symfony/css-selector": "2.3.*",
        "symfony/debug": "2.3.*",
        "symfony/finder": "2.3.*",
        "symfony/form": "2.3.*",
        "symfony/monolog-bridge": "2.3.*",
        "symfony/process": "2.3.*",
        "symfony/security": "2.3.*",
        "symfony/translation": "2.3.*",
        "symfony/twig-bridge": "2.3.*",
        "symfony/validator": "2.3.*",
        "symfony/yaml": "2.3.*",
        "doctrine/dbal": "2.3.*"
    },
    "require-dev": {
        "raveren/kint": "1.0.*@dev"
    },
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.1.x-dev"
        }
    }
}
danez commented 10 years ago

If you want to use 2.3 then make sure you pin all symfony packages to this version:

Check with composer which versions are installed of symfony-packages composer show --installed In the list you will probably find some symfony/x packages that are not 2.3 but 2.5. Then just pin these packages in your composer.json to 2.3.

Or use "symfony/symfony": "2.3.*" in your composer.json.

ghost commented 10 years ago

This did the trick. Sorry, I forgot about the nature of composer at this point.......

Thank you very much!

Best wishes!