Created
June 11, 2010 13:20
-
-
Save jankeesvw/434456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class NewsImage extends AppModel { | |
var $name = 'NewsImage'; | |
var $belongsTo = array( | |
'News' => array( | |
'className' => 'News', | |
'foreignKey' => 'news_id', | |
'conditions' => '', | |
'fields' => '', | |
'order' => '' | |
) | |
); | |
function beforeDelete(){ | |
$this->data = $this->findById($this->id); | |
return true; | |
} | |
function afterDelete() { | |
$filePath = WWW_ROOT.'img/'.$this->data["NewsImage"]["url"]; | |
unlink($filePath); | |
return true; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment