On Sun, Jul 25, 2010 at 8:08 AM, Abraham Boray <[email protected]> wrote:
>
> Still how can i get the informations about the last deleted record! in
> a normal delete(not in callback function, is there any way ?
> EG:
> if ($this->Picture->delete($id)) {
> here get the last deleted picture informations !!!!
> }
Say you have a column, path, in the pictures table. Have Cake save it
to a model var in the first callback and then remove the file in the
second.
class Picture extends AppModel
{
...
protected $_tmp_path;
function beforeDelete()
{
$this->_tmp_path = $this->field('path');
return true;
}
function afterDelete()
{
unlink(WWW_ROOT . $this->_tmp_path);
$this->_tmp_path = null;
}
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en