views:

59

answers:

1

I started out in cake 1.2.6 a short time ago and liked the controller dump feature because it showed me what was going on, and at which points in my app the objects were instantiated, and their contents.

In 1.3 how can I find out the names of instantiated objects, and how do I get a dump of them?

+1  A: 

If you put the following code inside function index() of your usersController (for example):

echo debug($this);

You can browse to '/users' to see the hierarchy.

Marshall Thompson
Ah, then I guess I can add it to the before_filter of my app_controller and get a dump of all controllers again. Thanks.
Mark Flint
I just tested that on one of my apps and it wouldn't work. I'm not sure if that means that it won't on any app, though. You may have to stick it in beforeRender.
Marshall Thompson
Sometimes I also find it useful to put an exit; right after so the layout is not messing with the indentation. Of course it will stop the rendering, but it makes for easier reading of $this.
cdburgess
I don't know why I haven't thought about that before. That really cleans things up!
Marshall Thompson