<?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 x() | |
{ | |
$cookies = $this->getDI()->get('cookies'); | |
$cookie = $cookies->get('cookie_name'); | |
var_dump($cookie->getValue()); | |
} | |
} | |
$di = new Phalcon\DI\FactoryDefault(); | |
$di->set('session', function() { | |
return new XSession(); | |
}); | |
$session = $di['session']; | |
echo $session->x(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment