On Thu, Apr 7, 2011 at 5:02 PM, David <dav...@ayamba.com> wrote: > I've got a component to do some common functions for a number of > controllers. When I'm in those controllers, I can use globally-common > functions from the app_controller. But when I'm in a component called > by a controller, those functions from the app_controller aren't > available. Isn't that sort of the point of the app_controller, and > since a component is under a controller, shouldn't it be able to > access? I don't quite understand why $this loses all its information > once you roll into a component. > > Why is this the case (interested in the theory behind this part of the > MVC), and is there a best practice way to access things from the > app_controller in a component?
Components don't extend controllers. But the controller is passed to the component's initialize() and startup() methods. class FooComponent extends Object { private $__Controller; function startup(&$controller) { $this->__Controller = $controller; } } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php