예제 #1
0
파일: Module.php 프로젝트: met-mw/SCMS
 public function getModuleSettings()
 {
     /** @var ModuleSetting[] $aModuleSettings */
     $aModuleSettings = $this->findRelationCache($this->getPrimaryKeyName(), ModuleSetting::cls());
     if (empty($aModuleSettings)) {
         $oModuleSettings = DataSource::factory(ModuleSetting::cls());
         $oModuleSettings->builder()->where("module_id={$this->getPrimaryKey()}");
         $aModuleSettings = $oModuleSettings->findAll();
         foreach ($aModuleSettings as $oModuleSetting) {
             $this->addRelationCache('id', $oModuleSetting);
             $oModuleSetting->addRelationCache('module_id', $this);
         }
     }
     return $aModuleSettings;
 }
예제 #2
0
 public function getModuleSetting()
 {
     /** @var ModuleSetting[] $aModuleSettings */
     $aModuleSettings = $this->findRelationCache('module_setting_id', ModuleSetting::cls());
     if (empty($aModuleSettings)) {
         $oModuleSettings = DataSource::factory(ModuleSetting::cls());
         $oModuleSettings->builder()->where("{$oModuleSettings->getPrimaryKeyName()}={$this->module_setting_id}");
         $aModuleSettings = $oModuleSettings->findAll();
         foreach ($aModuleSettings as $oModuleSetting) {
             $this->addRelationCache('module_setting_id', $oModuleSetting);
             $oModuleSetting->addRelationCache($oModuleSetting->getPrimaryKeyName(), $this);
         }
     }
     return isset($aModuleSettings[0]) ? $aModuleSettings[0] : null;
 }