Skip to content

Instantly share code, notes, and snippets.

@jankeesvw
Created June 14, 2010 08:11
Show Gist options
  • Save jankeesvw/437425 to your computer and use it in GitHub Desktop.
Save jankeesvw/437425 to your computer and use it in GitHub Desktop.
<?php
class PhotoAlbumImage extends AppModel {
var $name = 'PhotoAlbumImage';
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'PhotoAlbum' => array(
'className' => 'PhotoAlbum',
'foreignKey' => 'photo_album_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
function beforeDelete(){
$this->data = $this->findById($this->id);
return true;
}
function afterDelete() {
$filePath = WWW_ROOT.'img/'.$this->data["PhotoAlbumImage"]["url"];
unlink($filePath);
return true;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment