snowair / phalcon-debugbar

A powerful debug and profilers tool for the Phalcon Framework
MIT License
162 stars 49 forks source link

Exception when enable cache module #28

Closed Zaszczyk closed 8 years ago

Zaszczyk commented 8 years ago

Hi,

Firstly, I want to thank You for great module, it's really helpful :)

But I got a little error, I enabled cache module and got exception:

Phalcon\Di\Exception: Call to undefined method or service 'createProxy' 
/vagrant/www/vendor/snowair/phalcon-debugbar/src/PhalconDebugbar.php (265)

My configuration of cache DI is:

$di->setShared('cache', function () {
$cache = new Multiple([
    $this->get('redis'),
]);

return $cache;
});

$di->setShared('redis', function () {
$frontCache = new DataFrontend([
    'lifetime' => 3600 * 24 * 7
]);

$redis = new \Phalcon\Cache\Backend\Redis($frontCache, [
    'host' => $this->get('config')->redis->host,
    'port' => $this->get('config')->redis->port,
    'auth' => $this->get('config')->redis->password,
    'statsKey' => '_PHCR'
]);

return $redis;
});

What is wrong?

snowair commented 8 years ago

PHP > 5.4 ?

Zaszczyk commented 8 years ago

Yes, PHP 5.6

JCMais commented 8 years ago

Hi, same issue with latest phalcon version, 2.1.

I think I know what is the issue, from phalcon 2.1 changelog:

Phalcon\Di is now bound to services closures allowing use Phalcon\Di as $this to access services within them

So $this is not bound to the class PhalconDebugbar, but to the Di class.

snowair commented 8 years ago

I'll improve it for Phalcon 2.1, Thanks you