Beispiel #1
0
 /**
  * @param \Symfony\Component\HttpFoundation\Session\Session $session
  * @param string $key
  */
 public function __construct(Session $session, $key = 'profiler')
 {
     $this->session = $session;
     $bag = new NamespacedAttributeBag($key);
     // Profiler defines its own bag
     $bag->setName($key);
     $this->session->registerBag($bag);
     $this->key = $key;
 }
Beispiel #2
0
 /**
  * Set session name
  * @param string $sessionName
  */
 public function setSessionName($sessionName)
 {
     $this->_sessionName = new Session();
     $userAttributeBag = new NamespacedAttributeBag($sessionName);
     $userAttributeBag->setName($sessionName);
     $this->_sessionName->registerBag($userAttributeBag);
     if ($this->_sessionName->isStarted()) {
         $this->_sessionName->start();
     }
 }
 /**
  * @param Session $session
  */
 public function __construct(Session $session)
 {
     $this->session = $session;
     try {
         $bag = $this->session->getBag('pheat');
     } catch (InvalidArgumentException $e) {
         $bag = new NamespacedAttributeBag('_pheat_feature');
         $bag->setName('pheat');
         $this->session->registerBag($bag);
     }
     $this->bag = $bag;
 }
 /**
  * @return string
  */
 public function getCurrentRequestUri()
 {
     $uri = $this->attributeBag->get('current_uri');
     $this->attributeBag->remove('current_uri');
     return $uri;
 }
 protected function setUp()
 {
     $this->array = array('hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', 'csrf.token' => array('a' => '1234', 'b' => '4321'), 'category' => array('fishing' => array('first' => 'cod', 'second' => 'sole')));
     $this->bag = new NamespacedAttributeBag('_sf2', '/');
     $this->bag->initialize($this->array);
 }
Beispiel #6
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct(self::STORAGE_KEY);
 }
 public function testClear()
 {
     $this->bag->clear();
     $this->assertEquals(array(), $this->bag->all());
 }
 protected function get($key)
 {
     return $this->attributeBag->get($this->provider . '/' . $key);
 }
 public function save(User $user)
 {
     $this->namespacedAttributeBag->set('user', $user);
 }