I would like to get the value that was in database before a save in order to send an email saying that the content toto has chnaged to tata.
How could I get the previous value. I ve tried with beforeSave but it doesnt work
function beforeSave($options){
$value = $this->read();
$this->ModifiedValues = $value['Boite'];
return true;
}
function afterSave($created){
$addValues = $this->read();
if ( $created ) {
$mailOptions['subject'] = __('MailObjectAjoutBoite');
$mailOptions['templateView'] = 'ajout_feminin';
$mailOptions['templateLayout'] = 'avec_signature_fournitures';
$mailOptions['viewVars'] = array(
'value' => 'boîte',
'name' => $addValues['Boite']['name'],
'id' => $addValues['Boite']['id']
);
} else {
$mailOptions['subject'] = __('MailObjectModificationBoite');
$mailOptions['templateView'] = 'modification_feminin';
$mailOptions['templateLayout'] = 'avec_signature_fournitures';
$mailOptions['viewVars'] = array(
'value' => 'boîte',
'name' => $addValues['Boite']['name'],
'id' => $addValues['Boite']['id'],
'before' => $this->ModifiedValues['name']
);
}
$this->mail_send($mailOptions);
}
Thanks
--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Friday, August 24, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment