on_before_delete doesnt work
Hi, I try to delete pictures before i delete data from database table. And I found this code and try to edit to my case but doesnt work i try to debug it but var where is empty. Any solution?
function on_before_delete($where)
{
$id = $this->_determine_key_field_value($where);
$data = $this->find_by_key($id);
$files[] = assets_server_path('sluzby/'.$data->foto, 'images');
$files[] = assets_server_path('sluzby/thumb_'.$data->foto, 'images');
foreach($files as $file)
{
if (file_exists($file))
{
unlink($file);
}
}
}
Comments
function on_before_delete($where)
{
$id = $this->_determine_key_field_value($where);
$data = $this->find_by_key($id);
$files[] = assets_server_path('sluzby/'.$data['foto'], 'images');
$files[] = assets_server_path('sluzby/thumb_'.$data['foto'], 'images');
foreach($files as $file)
{
if (file_exists($file))
{
@unlink($file);
}
}
}