More on this: I put this in the controller:

function beforeFilter()
{
    die(debug($this->data));
}

So, when I submitted the form, all the data was right where it should
be. (Obviously, I commented it to get the form to display). So, its
disappearing act comes somewhere between beforeFilter() and add().
I've been trying to hunt down the precise order of operations but have
come up empty-handed. I know that I saw it somewhere once (it'd be
nice if this was included in the Cookbook's "A Typical CakePHP
Request" page). Is there anything between beforeFilter() and the
controller's action??

Before doing this, btw, there was no beforeFilter(). I've commented
AppController::beforeFilter(). I commented the $components array.
There's nothing in the model (nor AppModel) that would screw with the
data.

This was working earlier. Well, it was broken (it's early going) but I
could debugger::log($this->data) just fine before. I must have done
*something* to screw this up but, after staring at it for a couple of
hours now, I'm absolutely fresh out of ideas.

On Sun, Jan 11, 2009 at 11:40 PM, brian <[email protected]> wrote:
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to