Skip to content

Instantly share code, notes, and snippets.

@phalcon
Last active December 16, 2015 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/5483550 to your computer and use it in GitHub Desktop.
Save phalcon/5483550 to your computer and use it in GitHub Desktop.
<?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