コード例 #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['object_id', 'resource_id'], 'required'], [['type', 'data'], 'string'], [['active'], 'integer'], [['created', 'modified'], 'safe'], [['id', 'object_id', 'resource_id'], 'string', 'max' => 36], [['resource_id'], 'exist', 'skipOnError' => true, 'targetClass' => Resource::className(), 'targetAttribute' => ['resource_id' => 'id']], [['object_id'], 'exist', 'skipOnError' => true, 'targetClass' => Registry::className(), 'targetAttribute' => ['object_id' => 'id']]];
 }
コード例 #2
0
ファイル: Instance.php プロジェクト: psesd/sensor-hub
 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;
 }