added ConstructionConsentController::deleteAction()
This commit is contained in:
@@ -34,6 +34,33 @@ class ConstructionConsent extends mfBaseModel {
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function beforeDelete() {
|
||||
if(!$this->id) return true;
|
||||
// delete owners
|
||||
foreach($this->getProperty("owners") as $owner) {
|
||||
$owner->delete();
|
||||
}
|
||||
// delete contacts
|
||||
foreach($this->getProperty("contacts") as $contact) {
|
||||
$contact->delete();
|
||||
}
|
||||
// delete journals
|
||||
foreach($this->getProperty("journal") as $journal) {
|
||||
$journal->delete();
|
||||
}
|
||||
// delete history
|
||||
foreach($this->getProperty("history") as $history) {
|
||||
$history->delete();
|
||||
}
|
||||
// delete files
|
||||
if($this->getProperty("file")) {
|
||||
$this->getProperty("file")->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
protected function afterSave() {
|
||||
$this->createHistory();
|
||||
}
|
||||
@@ -181,7 +208,7 @@ class ConstructionConsent extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "file") {
|
||||
if(!$this->id) return [];
|
||||
if(!$this->id) return null;
|
||||
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id]);
|
||||
if($file) {
|
||||
$this->file = $file;
|
||||
|
||||
Reference in New Issue
Block a user