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
Saturday, January 28, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment