Skip to main content

How to get model data after when save ( CakePHP )

I want to get the latest data from the model after when save but don't needit has saved without doing another select  . Now i

Currently I do like this:

if ($this->Model->save($data)){
      $last = $this->Model->find('first',array('conditions'=>array
        'conditions' => array('Model.id'=>$thisid' => $this->Model->id));
    );
  $last['Model']['dataChangeByBehaviors'];  $last['Model']['dataChangedByBehaviors']; //-- <-- data I want get this
}

iI want to get any data that don't need select as above examplewas set in model callbacks or behaviors without performing an extra find.

How to get data after when save ( CakePHP )

I want get data after when save but don't need select  . Now i do like this:

if ($this->Model->save($data)){
      $last = $this->Model->find('first',array('conditions'=>array('Model.id'=>$this->Model->id));
      $last['Model']['dataChangeByBehaviors'];  //---- I want get this
}

i want get data that don't need select as above example.

How to get model data after save ( CakePHP )

I want to get the latest data from the model after it has saved without doing another select.

Currently I do this:

if ($this->Model->save($data)){
    $last = $this->Model->find('first',array(
        'conditions' => array('Model.id' => $this->Model->id)
    );
    $last['Model']['dataChangedByBehaviors']; // <-- data I want
}

I want to get any data that was set in model callbacks or behaviors without performing an extra find.

Post Closed as "not a real question" by hakre, BastiBen, Mario S, Maerlyn, Nope
Source Link
meotimdihia
  • 4.3k
  • 15
  • 51
  • 70

How to get data after when save ( CakePHP )

I want get data after when save but don't need select . Now i do like this:

if ($this->Model->save($data)){
      $last = $this->Model->find('first',array('conditions'=>array('Model.id'=>$this->Model->id));
      $last['Model']['dataChangeByBehaviors'];  //---- I want get this
}

i want get data that don't need select as above example.