Thanks, Where do I put it though?

I tried this:

$existing_id = $this->request->data['Ladder']['id'];
$new_record = $this->Ladder->findById($existing_id);
unset($new_record['Ladder']['id']);
$new_record['Ladder']['level'] = $next_round;
$new_record['Ladder']['status'] = 0;
print_r($new_record);
$this->Ladder->create();
$this->Ladder->save($new_record);


Which does create the new record but it isn't saving the changed
values within the $new_record array. It is just saving the same
details as the original.

print_r($new_record); - this is showing the data has been updated but
it isn't being used in the create / save of the new record.

Thanks



On Feb 15, 5:38 pm, Andras Kende <and...@kende.com> wrote:
> try to add:
>
> $this->Ladder->create();
>
> Andras Kende
>
> On Feb 15, 2012, at 1:12 AM, elogic wrote:
>
>
>
>
>
>
>
> > Thanks,
>
> > This is what I have:
>
> > // GET THE EXISTING RECORD, REMOVE THE ID, UPDATE THE LEVEL AND SAVE
> > // -------------------------------------------------------------->
> > $existing_id = $this->request->data['Ladder']['id'];
> > $new_record = $this->Ladder->findById($existing_id);
> > unset($new_record['Ladder']['id']);
> > $new_record['Ladder']['level'] = $next_round;
> > $this->Ladder->save($new_record);
>
> > Nothing is saving though?
>
> > Thanks
>
> > On Feb 15, 4:16 pm, Jeremy Burns | Class Outfit
> > <jeremybu...@classoutfit.com> wrote:
> >> Do a find, remove the 'id' key from the resulting array, change the value 
> >> of the field/key you want and then save it again. The lack of an id key 
> >> will force a save rather than an update.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >>http://www.classoutfit.com
>
> >> On 15 Feb 2012, at 06:04:20, elogic wrote:
>
> >>> Is there an easy way to create a duplicate record using cakePHP and
> >>> maybe change one field in the duplication while still keeping the
> >>> original?
>
> >>> Thanks
>
> >>> --
> >>> Our newest site for the community: CakePHP Video 
> >>> Tutorialshttp://tv.cakephp.org
> >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> >>> 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 
> >>> athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 
> > athttp://groups.google.com/group/cake-php

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