Re: create duplicate record

2012-02-15 Thread elogic
Ignore this, user error.

I had the field in the database setup incorrectly so it would accept
the value I was changing.

Thanks

On Feb 16, 7:38 am, elogic  wrote:
> 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  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
> > >  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.organdhelpothers 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.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 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


Re: create duplicate record

2012-02-15 Thread elogic
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  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
> >  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


Re: create duplicate record

2012-02-14 Thread Andras Kende
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
>  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.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

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


Re: create duplicate record

2012-02-14 Thread elogic
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
 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.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


Re: create duplicate record

2012-02-14 Thread Jeremy Burns | Class Outfit
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 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

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


create duplicate record

2012-02-14 Thread elogic
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 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