added ConstructionConsentController::deleteAction()
This commit is contained in:
@@ -10,6 +10,15 @@ class ConstructionConsentOwner extends mfBaseModel {
|
||||
$this->createHistory();
|
||||
}
|
||||
|
||||
protected function beforeDelete() {
|
||||
if(!$this->id) return true;
|
||||
foreach($this->getProperty("files") as $file) {
|
||||
$file->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function beforeUpdate($data) {
|
||||
if(!array_key_exists("edit_by", $data)) {
|
||||
$me = new User();
|
||||
@@ -45,13 +54,16 @@ class ConstructionConsentOwner extends mfBaseModel {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "files") {
|
||||
if(!$this->id) return null;
|
||||
if(!$this->id) return [];
|
||||
$files = ConstructionConsentOwnerFile::search(["constructionconsentowner_id" => $this->id]);
|
||||
if(count($files)) {
|
||||
foreach($files as $file) {
|
||||
$this->files[$file->filename] = $file;
|
||||
}
|
||||
|
||||
if(!count($files)) {
|
||||
return [];
|
||||
}
|
||||
foreach($files as $file) {
|
||||
$this->files[$file->filename] = $file;
|
||||
}
|
||||
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user