Beispiel #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;
 }
Beispiel #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['ServiceReference'] = ServiceReference::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;
 }
Beispiel #3
0
 public static function getSensorObjectModelClass(\psesd\sensors\base\BaseInterface $object)
 {
     if ($object instanceof SensorInterface) {
         return SensorModel::className();
     }
     if ($object instanceof ServiceInterface) {
         return ServiceModel::className();
     }
     if ($object instanceof ServiceReferenceInterface) {
         return ServiceReferenceModel::className();
     }
     if ($object instanceof ResourceReferenceInterface) {
         return ResourceReferenceModel::className();
     }
     if ($object instanceof ResourceInterface) {
         return ResourceModel::className();
     }
     if ($object instanceof SiteInterface) {
         return SiteModel::className();
     }
     if ($object instanceof ServerInterface) {
         return ServerModel::className();
     }
     if ($object instanceof ProviderInterface) {
         return ProviderModel::className();
     }
     return false;
 }