user198003
user198003

Reputation: 11151

How to use session defined variables in controller?

how can i use session variables in my controllers? do i need some specific helper, or component?

i need to use some of Auth defined variables, like

$session->read('Auth.User.user_type_id')

... etc.

tnx in adv!

Upvotes: 0

Views: 539

Answers (1)

mikegreenberg
mikegreenberg

Reputation: 1421

When using Sessions in your Controller, you can access this info via the Session Component. The component will setup the abstraction layer and make it available to the rest of the application. If you need to use the Session in your Views, you will also need to include the Session Helper.

The Auth component automatically uses the session if configured as such. You can see what is available in the Session data by using debug($this->Session->read());.

Upvotes: 1

Related Questions