I'm trying to debug a problem with one of my controllers where
$this->data is (almost) empty (more on that in a sec) and so tossed a
bunch of Debugger::log statements in the action. When I checked the
debug.log I found that the entries are being repeated.

The action starts out like this. I put several debugger statements in
because I was trying to figure out what was happening to $this->data.

public function add($media_type_slug = null)
{
        $this->set('user_id', $this->Session->read('User.id'));

        debugger::log('controller -- first');
        debugger::log($this->data);
        ...
        // more stuff, and several other Debugger::log() statements

debug.log:

2009-01-11 23:17:17 Debug: "controller -- first"
2009-01-11 23:17:17 Debug: null
2009-01-11 23:17:19 Debug: "controller -- first"
2009-01-11 23:17:19 Debug: null
2009-01-11 23:17:21 Debug: "controller -- first"
2009-01-11 23:17:21 Debug: null
2009-01-11 23:17:50 Debug: "controller -- first"
2009-01-11 23:17:50 Debug: array(
        "Record" => array(),
        "Discipline" => array()
)
2009-01-11 23:17:50 Debug: "controller -- second"
2009-01-11 23:17:50 Debug: array(
        "Record" => array(),
        "Discipline" => array()
)
2009-01-11 23:17:50 Debug: "controller -- third"
2009-01-11 23:17:50 Debug: array(
        "Record" => array(),
        "Discipline" => array()
)


The first 3 occur the first time I hit the action. $this->data is
properly empty. What's weird, though, is that Debugger places 3
entries, each 2 seconds apart, in the log.

Now, when I submit the form at 23:17:50, I don't see that first one
repeated. So, what's up with that? It can't be that Cake is running
through the method 3 times the first time, can it? Because the other
Debugger stateents are all inside an if(empty($this->data)) block.

Anyway, besides all of that, as you can see, when the form is
submitted, I'm only seeing the names of the 2 models used in the form,
but no data at all. Anyone have any ideas on that? I'm well and truly
stumped!

The form is nothing special and looks like:

echo $form->create('Record', array('action' => 'add', 'type' => 'file'));
echo $form->hidden('Record.user_id', array('value' => $user_id));
echo $form->hidden('Record.media_type_id', array('value' =>
$media_type['MediaType']['id']));
echo $form->hidden('Record.media_type_slug', array('value' =>
$media_type['MediaType']['slug']));
...

echo $form->end('send it');

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to