Permalink
Browse files

Add component and helper wrapper methods.

  • Loading branch information...
dereuromark committed Dec 23, 2014
1 parent 813925a commit 545ff20e1dbb575db1eef17360f4e7c4343db2fa
Showing with 30 additions and 6 deletions.
  1. +16 −4 lib/Cake/Controller/Component/SessionComponent.php
  2. +14 −2 lib/Cake/View/Helper/SessionHelper.php
@@ -41,7 +41,7 @@ public function userAgent($userAgent = null) {
}
/**
* Used to write a value to a session key.
* Writes a value to a session key.
*
* In your controller: $this->Session->write('Controller.sessKey', 'session value');
*
@@ -56,7 +56,7 @@ public function write($name, $value = null) {
}
/**
* Used to read a session values for a key or return values for all keys.
* Reads a session value for a key or returns values for all keys.
*
* In your controller: $this->Session->read('Controller.sessKey');
* Calling the method without a param will return all session vars
@@ -70,7 +70,7 @@ public function read($name = null) {
}
/**
* Wrapper for SessionComponent::del();
* Deletes a session value for a key.
*
* In your controller: $this->Session->delete('Controller.sessKey');
*
@@ -83,7 +83,19 @@ public function delete($name) {
}
/**
* Used to check if a session variable is set
* Reads and deletes a session value for a key.
*
* In your controller: `$this->Session->consume('Controller.sessKey');`
*
* @param string $name the name of the session key you want to read
* @return mixed values from the session vars
*/
public function consume($name) {
return CakeSession::consume($name);
}
/**
* Checks if a session variable is set.
*
* In your controller: $this->Session->check('Controller.sessKey');
*
@@ -30,7 +30,7 @@
class SessionHelper extends AppHelper {
/**
* Used to read a session values set in a controller for a key or return values for all keys.
* Reads a session value for a key or returns values for all keys.
*
* In your view: `$this->Session->read('Controller.sessKey');`
* Calling the method without a param will return all session vars
@@ -44,7 +44,19 @@ public function read($name = null) {
}
/**
* Used to check is a session key has been set
* Reads and deletes a session value for a key.
*
* In your view: `$this->Session->consume('Controller.sessKey');`
*
* @param string $name the name of the session key you want to read
* @return mixed values from the session vars
*/
public function consume($name) {
return CakeSession::consume($name);
}
/**
* Checks if a session key has been set.
*
* In your view: `$this->Session->check('Controller.sessKey');`
*

0 comments on commit 545ff20

Please sign in to comment.