OK, but how to fix error with 'crypt' service?
Thr code below doesn't work.
<?php
class XSession extends Phalcon\Session\Adapter implements
Phalcon\Session\AdapterInterface,
Phalcon\DI\InjectionAwareInterface
{
protected $_dependencyInjector;
public function setDI($di)
{
$this->_dependencyInjector = $di;
}
public function getDI()
{
return $this->_dependencyInjector;
}
public function start()
{
$cookies = $this->getDI()->get('cookies');
$cookie = $cookies->get('session_id');
var_dump($cookie->getValue());
}
}
$di = new Phalcon\DI\FactoryDefault();
$di->set('session', function() use ($di) {
$session = new XSession();
$session->setDI($di);
return $session;
});
$session = $di['session'];
echo $session->start();
It throws the Fatal error only if cookie 'session_id' is provided by user.
Fatal error: Uncaught exception 'Phalcon\DI\Exception' with message 'Service 'crypt' wasn't found in the dependency injection container' in [...]/public/index.php:24
Stack trace:
#0 [internal function]: Phalcon\DI->get('crypt', NULL)
#1 [internal function]: Phalcon\DI->getShared('crypt')
#2 [...]/public/index.php(24): Phalcon\Http\Cookie->getValue()
#3 [...]/public/index.php(40): XSession->start()
#4 {main} thrown in [...]/public/index.php on line 24