Пример #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['object_id', 'service_id'], 'required'], [['type', 'data'], 'string'], [['active'], 'integer'], [['created', 'modified'], 'safe'], [['id', 'object_id', 'service_id'], 'string', 'max' => 36], [['service_id'], 'exist', 'skipOnError' => true, 'targetClass' => Service::className(), 'targetAttribute' => ['service_id' => 'id']], [['object_id'], 'exist', 'skipOnError' => true, 'targetClass' => Registry::className(), 'targetAttribute' => ['object_id' => 'id']]];
 }
Пример #2
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;
 }