7.9 Session

As a natural counterpart to the Session Component, the Session Helper replicates most of the components functionality and makes it available in your view. The Session Helper is automatically added to your view — it is not necessary to add it to the $helpers array in the controller.

You major difference between the Session Helper and the Session Component is that the helper does not have the ability to write to the session.

As with the Session Component, data is written to and read by using dot separated array structures.

	array('User' => 
			array('username' => 'super@example.com')
	);
  1. array('User' =>
  2. array('username' => 'super@example.com')
  3. );

Given the previous array structure, the node would be accessed by User.username, with the dot indicating the nested array. This notation is used for all Session helper methods wherever a $key is used.