Last active
December 16, 2015 19:11
-
-
Save phalcon/5483550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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