Created
February 11, 2011 17:43
-
-
Save wearethefoos/822724 to your computer and use it in GitHub Desktop.
A question a lot of people seem to ask about the CakePHP Session Component is how to access it from e.g. a Model. There are quite a few suggestions to be found on Google, but none of them strike me as very elegant. I came up with this one, and it works fr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App::import('Core', 'Controller'); | |
App::import('Component', 'Session'); | |
$Controller = new Controller(); | |
$Session = new SessionComponent(); | |
$Session->startup($Controller); | |
$Session->read('Auth.User'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment