0

I am developing an application in cakephp. I need to get id's of all the rows that have been updated using updateAll() function in cakephp. Any suggestions would be highly appreciated. Thanx..

Is this what i should do in my App Model

class AppModel extends Model {

    var $infos = array();

    function updateAll($fields, $conditions = true) {
        $this->$infos = $this->find('all', array('conditions' => $conditions));
        $return = parent::updateAll($fields, $conditions);
        $this->afterUpdateAll();
        return $return;
    }


    function afterUpdateAll(){
        foreach ($this->$infos as $info) {
            //do something
        }
    }

}

Will this work..?

tereško
  • 58,060
  • 25
  • 98
  • 150
Vineet
  • 287
  • 2
  • 14

2 Answers2

1

You have to issue a find passing the same conditions you passed to updateAll.

If the update operation changes data in any of the columns used in the conditions, you should use find before calling updateAll.

bfavaretto
  • 71,580
  • 16
  • 111
  • 150
0

If you UPDATE uncial rows - you may just SELECT them again after UPDATE

dr.dimitru
  • 2,645
  • 1
  • 27
  • 36