Changeset 378 for trunk/Common/Model.php
- Timestamp:
- Jan 20, 2012, 3:32:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Model.php
r377 r378 229 229 if($Property['Type'] == PropertyOneToMany) 230 230 { 231 if(!$this->Module->Models[$Property['TargetModel']]->Installed) 232 $this->Module->Models[$Property['TargetModel']]->Install(); 231 if(array_key_exists($Property['TargetModel'], $this->Module->Models)) 232 { 233 if(!$this->Module->Models[$Property['TargetModel']]->Installed) 234 $this->Module->Models[$Property['TargetModel']]->Install(); 235 } 233 236 $this->Database->query('ALTER TABLE `'.$this->Name.'` ADD FOREIGN KEY (`'.$Property['Name'].'`) REFERENCES `'.$Property['TargetModel'].'` (`Id`);'); 234 237 } … … 238 241 function UnInstall() 239 242 { 240 foreach($ Model->Properties as $Property)243 foreach($this->Properties as $Property) 241 244 { 242 245 if($Property['Type'] == PropertyManyToMany) … … 244 247 } 245 248 $this->Database->query('DROP TABLE IF EXISTS `'.$this->Name.'`'); 249 $this->Installed = false; 246 250 } 247 251 }
Note:
See TracChangeset
for help on using the changeset viewer.