Saturday, January 28, 2012

Re: not updating modified, how ?

try something like:
$this->request->data['Device']['updated'] = false;

On Sat, Jan 28, 2012 at 4:37 PM, Charles Bueche <cblists@bueche.ch> wrote:
Hey bakers,

I'm using CakePHP 2.1 on Ubuntu.

I'm trying to update a single DB field, without CakePHP updating the "modified" field. Here is my code:

            $this->Device->id = $device_id;
            $this->request->data['Device']['last_seen'] = date("Y-m-d H:i:s");
            $this->request->data['modified'] = false;
            $this->Device->save($this->request->data, array('fieldList' => array( 'last_seen')));

However, "modified" gets an update. In http://book.cakephp.org/2.0/en/models/saving-your-data.html, there is a tip saying " If you don't want the updated field to be updated when saving some data add 'updated' => false to your $data array".

I tried 'updated' => false and 'modified' => false, but "modified" always gets an update. Any idea how I can avoid this ?

TIA,
Charles

--
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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: