Sunday, December 5, 2010

SessionComponent not always available

I had been using the default app controller, and now, following the examples in the Authentication section of the book...

http://book.cakephp.org/view/1250/Authentication

...I added an app_controller.php to my project and put this into it:


<?php
class AppController extends Controller {
var $components = array('Auth');
}


And my flash messages stopped working:


Notice: Undefined property: FooController::$Session [APP/controllers/foo_controller.php, line 43]
Fatal error: Call to a member function setFlash() on a non-object in /path/to/app/controllers/foo_controller.php on line 43


The documentation for $components says:


http://book.cakephp.org/view/961/components-helpers-and-uses

"The Html, Form, and Session Helpers are always available by default, as is the SessionComponent" however this appears to be false. Everything went back to working as soon as I changed my app_controller.php to:


<?php
class AppController extends Controller {
var $components = array('Auth', 'Session');
}


So is the documentation wrong about SessionComponent always being available, or am I doing something wrong?


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: