Esempio n. 1
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['ResourceReference'] = ResourceReference::find()->where(['resource_id' => $this->id, 'active' => $active])->all();
     return $models;
 }
Esempio n. 2
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;
 }