Thursday, May 30, 2013

Foreach saveField fails

I am switching up a table 'id' field and simple doing a find all, generate a UUID, and try to update the field foreach but all its doing is creating new empty records.

 

 

foreach($this->find('all') as $entry) {

                $new = String::uuid();

                $this->id = $entry['Entry']['id'];

                //debug($this->id);

                $this->saveField('id', $new);

}

 

If I remove the commented out debug() I get all the original id's but it simply not update the record.

 

Even tried $this->updateAll(array('Entry.id' => $new), array('Entry.id' => $entry['Entry']['id']));

 

But that does not seem to work eiter.

 

Any ideas?

 

No comments: