Esempio n. 1
0
 public function parentModels()
 {
     $models = [];
     $models['Sensor'] = Sensor::find()->where(['id' => $this->object_id])->all();
     $models['Service'] = Service::find()->where(['id' => $this->object_id])->all();
     $models['ServiceReference'] = ServiceReference::find()->where(['id' => $this->object_id])->all();
     // $models['ResourceReference'] = ResourceReference::find()->where(['resource_id' => $this->id])->all();
     $models['Server'] = Server::find()->where(['id' => $this->object_id])->all();
     $models['Site'] = Site::find()->where(['id' => $this->object_id])->all();
     return $models;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 public function childModels($careAboutActive = true)
 {
     if ($careAboutActive) {
         $active = 1;
     } else {
         $active = [0, 1];
     }
     $models = [];
     $models['Resource'] = Resource::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     $models['Sensor'] = Sensor::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     $models['Service'] = Service::find()->where(['id' => $this->service_id, 'active' => $active])->all();
     $models['ResourceReference'] = ResourceReference::find()->where(['object_id' => $this->id, 'active' => $active])->all();
     if ($serviceProvider = Registry::getObject($this->object_id)) {
         if (!$careAboutActive || !empty($serviceProvider->active)) {
             $models['ServiceProvider'] = [$serviceProvider];
         }
     }
     return $models;
 }