Login +

Reference Guide / SLS_Session

SLS_Session1 is a class that allows you to manipulate data in session.

Accessibility

At Controller level, you can access it directly by inheritance on SLS_Generic2Controller:

$this->_session;

At others levels (PHP), you can access it by reference to SLS_Generic2:

$this->_generic->getObjectSession();
// Or if u haven't a reference to SLS_Generic, using the singleton:
SLS_Generic::getInstance()->getObjectSession();

Data recovery

- If you want to retrieve all the parameters, you can use the getParams() function:

$this->_session->getParams();

- If you want to retrieve a particular parameter, you can use the getParam() function:

$this->_session->getParam($param);

- If you want to retrieve the key of a value, you can use the getKey() function:

$this->_session->getKey($value);

Data updates

- If you want to change the value of a key, use the setParam() function:

$this->_session->setParam($key, $value);

- If you want to delete a key, use the delParam() function:

$this->_session->delParam($key);

- If you want to destroy the entire session, use the destroy() function:

$this->_session->destroy();

References

  1. SLS_Session - SLS_Session class - Manage session
  2. SLS_Generic - Generic Class - Used eveywhere in the application