bump?

On Sep 22, 10:17 am, trustfundbaby <[EMAIL PROTECTED]> wrote:
> Just wanted to follow up on this threadhttp://is.gd/2XoO, because I'm
> having the same exact problem
> I've been trying to figure this one out for the last 5 hours (so no
> sleep yet :] ... )
>
> cakephp version: 1.2RC2
> Mysql version: 4.1
>
> PHP version: various (see post)
>
> I have a 'Question' model that hasMany 'Answers' ... and I'm trying to
> use $this->saveAll to save the Question and its possible answers
>
> The data array from my form looks like this
> ---------------------------------------------------------------------
> Array
> (
>     [Question] => Array
>         (
>             [question_type_id] => 1
>             [question] => question time
>             [help_text] =>
>         )
>
>     [Answer] => Array
>         (
>             [1] => Array
>                 (
>                     [answer_text] => answer1
>                 )
>             [2] => Array
>                 (
>                     [answer_text] => answer2
>                 )
>             [3] => Array
>                 (
>                     [answer_text] => answer3
>                 )
>         )
> )
> ---------------------------------------------------------------------
> and my create action in QuestionController looks like this
>
> ---------------------------------------------------------------------
>     function create(){
>         if(!empty($this->data)):
>             $this->Question->create();
>             if($this->Question->saveAll($this->data)):
>                 $this->Session->setFlash('Success', 'default',
> array('class' => 'success'));
>                 #clear out the data*/
>                 //$this->data = array();
>             else:
>                 $this->Session->setFlash('Error');
>             endif;
>         endif;
>     }
> ---------------------------------------------------------------------
>
> But just like in the thread I posted above, the question is inserted
> and the answers too ... but with no question_ids.
> From my research, the problem occurs with PHP 4.3.11 and PHP 4.4.9
> (Apache module) ... as soon as I use PHP5.2.5 (cgi) ... then the
> insertions work with the correct question_ids going in.
>
> I looked in the source code (/cake/libs/model.php)
> And it turns out that $this->id is not being set properly in PHP4
> because right before line 1405 in the file
> if I insert a
> [code]
> var_dump($this->id);exit;
> [/code]
>
> I get 'false' for PHP4 and the actual correct insert_id for PHP5.
> So that's where the problem is.
>
> I can't find out where $this->id is supposed to be set to debug
> further.
> Can someone give me some pointers on where to look or help out?
> .
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to