Remove "loopback.DataModel"
The model was just a temporary alias to simplify migration of code based on <=2.0.0-beta3
This commit is contained in:
parent
76bd587198
commit
804c71d7c6
|
@ -400,14 +400,6 @@ loopback.autoAttachModel = function(ModelCtor) {
|
||||||
return this.registry.autoAttachModel.apply(this.registry, arguments);
|
return this.registry.autoAttachModel.apply(this.registry, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
// temporary alias to simplify migration of code based on <=2.0.0-beta3
|
|
||||||
// TODO(bajtos) Remove this in v3.0
|
|
||||||
Object.defineProperty(loopback, 'DataModel', {
|
|
||||||
get: function() {
|
|
||||||
return this.registry.DataModel;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Built in models / services
|
* Built in models / services
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -107,14 +107,8 @@ Registry.prototype.createModel = function(name, properties, options) {
|
||||||
BaseModel = this.getModel(BaseModel);
|
BaseModel = this.getModel(BaseModel);
|
||||||
|
|
||||||
if (BaseModel === undefined) {
|
if (BaseModel === undefined) {
|
||||||
if (baseName === 'DataModel') {
|
console.warn('Model `%s` is extending an unknown model `%s`. ' +
|
||||||
console.warn('Model `%s` is extending deprecated `DataModel. ' +
|
'Using `PersistedModel` as the base.', name, baseName);
|
||||||
'Use `PersistedModel` instead.', name);
|
|
||||||
BaseModel = this.getModel('PersistedModel');
|
|
||||||
} else {
|
|
||||||
console.warn('Model `%s` is extending an unknown model `%s`. ' +
|
|
||||||
'Using `PersistedModel` as the base.', name, baseName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,15 +451,3 @@ Registry.prototype.autoAttachModel = function(ModelCtor) {
|
||||||
ModelCtor.attachTo(ds);
|
ModelCtor.attachTo(ds);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// temporary alias to simplify migration of code based on <=2.0.0-beta3
|
|
||||||
Object.defineProperty(Registry.prototype, 'DataModel', {
|
|
||||||
get: function() {
|
|
||||||
var stackLines = new Error().stack.split('\n');
|
|
||||||
console.warn('loopback.DataModel is deprecated, ' +
|
|
||||||
'use loopback.PersistedModel instead.');
|
|
||||||
// Log the location where loopback.DataModel was called
|
|
||||||
console.warn(stackLines[2]);
|
|
||||||
return this.PersistedModel;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ describe('loopback', function() {
|
||||||
'Change',
|
'Change',
|
||||||
'Checkpoint',
|
'Checkpoint',
|
||||||
'Connector',
|
'Connector',
|
||||||
'DataModel',
|
|
||||||
'DataSource',
|
'DataSource',
|
||||||
'Email',
|
'Email',
|
||||||
'GeoPoint',
|
'GeoPoint',
|
||||||
|
|
Loading…
Reference in New Issue