コード例 #1
0
ファイル: Provider.php プロジェクト: psesd/sensor-hub
 public function dependentModels()
 {
     $models = [];
     $models['Sensor'] = Sensor::find()->where(['object_id' => $this->id])->all();
     $models['Server'] = Server::find()->where(['provider_id' => $this->id])->all();
     $models['Resource'] = Resource::find()->where(['object_id' => $this->id])->all();
     $models['Site'] = Site::find()->where(['provider_id' => $this->id])->all();
     return $models;
 }
コード例 #2
0
ファイル: Server.php プロジェクト: psesd/sensor-hub
 public function childModels($active = true)
 {
     if ($active) {
         $active = 1;
     } else {
         $active = [0, 1];
     }
     $models = [];
     $models['Sensor'] = Sensor::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     $models['Service'] = Service::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     $models['Resource'] = Resource::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     $models['ResourceReference'] = ResourceReference::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     return $models;
 }
コード例 #3
0
 public function childModels($careAboutActive = true)
 {
     if ($careAboutActive) {
         $active = 1;
     } else {
         $active = [0, 1];
     }
     $models = [];
     $models['Resource'] = Resource::find()->where(['id' => $this->resource_id, 'active' => $active])->all();
     if ($resourceProvider = Registry::getObject($this->object_id)) {
         if (!$careAboutActive || !empty($resourceProvider->active)) {
             $models['ResourceProvider'] = [$resourceProvider];
         }
     }
     return $models;
 }