Changeset 893 for trunk/Packages/Common
- Timestamp:
- Jan 4, 2021, 9:55:40 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/AppModule.php
r891 r893 73 73 } 74 74 75 staticfunction GetModels(): array75 function GetModels(): array 76 76 { 77 77 return array(); … … 84 84 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled)); 85 85 $this->Manager->Perform($List, array(ModuleAction::Install), array(ModuleCondition::NotInstalled)); 86 $this->InstallModels(); 86 87 $this->DoInstall(); 87 88 $this->Installed = true; … … 99 100 $this->Manager->Perform($List, array(ModuleAction::Uninstall), array(ModuleCondition::Installed)); 100 101 $this->DoUninstall(); 102 $this->UninstallModels(); 101 103 } 102 104 … … 188 190 { 189 191 $this->Models[get_class($Model)] = $Model; 192 } 193 194 function InstallModels(): void 195 { 196 foreach ($this->GetModels() as $Model) 197 { 198 $this->InstallModel($Model::GetDesc()); 199 } 200 } 201 202 function UninstallModels(): void 203 { 204 foreach (array_reverse($this->GetModels()) as $Model) 205 { 206 $this->UninstallModel($Model::GetDesc()); 207 } 190 208 } 191 209 … … 242 260 $Query .= "ALTER TABLE `".$ModelDesc->Name."` ". 243 261 "ADD CONSTRAINT `".$ModelDesc->Name."_ibfk_".$I."` FOREIGN KEY (`".$Column->Name."`) REFERENCES `".$Column->RefTable."` (`Id`);"; 262 $I++; 244 263 } 245 264 $this->Database->query($Query);
Note:
See TracChangeset
for help on using the changeset viewer.