I already gave you the answer in my previous post
anyway:
http://book.cakephp.org/2.0/en/development/debugging.html?highlight=debugging

for starters you can simply output and die:

$var = $this->OsChoiceHistory->validationErrors;
debug($var);
die();


On 17 Dez., 18:35, roundrightfarm <roundrightf...@gmail.com> wrote:
> did you try to debug     $this->OsChoiceHistory->validationErrors or
>   $this->OsChoiceHistory->invalidFields()
>
> how do I do this? and where do I go to see the results?
>
> Thanks
>
> On Dec 17, 9:26 am, euromark <dereurom...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > did you try to debug
> >     $this->OsChoiceHistory->validationErrors
> > or
> >     $this->OsChoiceHistory->invalidFields()
> > ?
> > they should contain an array of fields that probably made sure the
> > save was unsuccessfull
> > it would also be wise to debug the result of the last save()
> >     $res = $this->OsChoiceHistory->save($new_entry);
> >     debug($res);
>
> > On 17 Dez., 18:17, roundrightfarm <roundrightf...@gmail.com> wrote:
>
> > > I can't create a new record in my database table.
>
> > > Here is the code I am using
>
> > > [code]foreach($boxes as $box) {
> > >                         //check and see if the box's owner has any 
> > > optional shares
> > >                         //if they do, add the product to the boxes item 
> > > table so it will be
> > > included with their order list and aggregate product order totals
> > >                         $optional_share_users = 
> > > $this->OptionalShareUser->find('all');
> > >                         foreach ($optional_share_users as $share_user){
> > >                                 if ($box['Box']['user_id'] == 
> > > $share_user['OptionalShareUser']
> > > ['user_id']){
> > >                                         $this->BoxesItem->read(null, 
> > > $box['Box']['id']);
> > >                                         $this->BoxesItem->create();
> > >                                         $new_optional_share_item = array(
> > >                                                 'BoxesItem' => array(
> > >                                                         'box_id' => 
> > > $box['Box']['id'],
> > >                                                         'item_id' => 
> > > $share_user['OptionalShareUser']
> > > ['current_product_id']
> > >                                                 )
> > >                                         );
> > >                                         
> > > $this->BoxesItem->save($new_optional_share_item);
>
> > >                                 //now make a new record for the item in 
> > > the os_choice_history
> > > table
>
> > >                                         $this->OsChoiceHistory->create();
> > >                                         $new_entry = array(
> > >                                                 'OsChoiceHistory' => 
> > > array(
> > >                                                         'week_id' => 
> > > $current_shown_week_id,
> > >                                                         
> > > 'optional_share_id' => $share_user['OptionalShareUser']
> > > ['share_id'],
> > >                                                         'user_id' => 
> > > $share_user['OptionalShareUser']['user_id'],
> > >                                                         'item_id' => 
> > > $share_user['OptionalShareUser']
> > > ['current_product_id']
> > >                                                 )
> > >                                         );
> > >                                         
> > > $this->OsChoiceHistory->save($new_entry);
>
> > >                                 }
> > >                         }
>
> > >                         [/code]
>
> > > This code runs without any errors, and the first half works to save to
> > > the boxes_items table, but the second half leaves the
> > > os_choice_histories table unchanged.   Any ideas what I'm missing here

-- 
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

Reply via email to