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:
Miroslav Bajtoš 2016-01-25 10:15:57 +01:00
parent 76bd587198
commit 804c71d7c6
3 changed files with 2 additions and 29 deletions

View File

@ -400,14 +400,6 @@ loopback.autoAttachModel = function(ModelCtor) {
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
*/

View File

@ -107,16 +107,10 @@ Registry.prototype.createModel = function(name, properties, options) {
BaseModel = this.getModel(BaseModel);
if (BaseModel === undefined) {
if (baseName === 'DataModel') {
console.warn('Model `%s` is extending deprecated `DataModel. ' +
'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);
}
}
}
BaseModel = BaseModel || this.getModel('PersistedModel');
var model = BaseModel.extend(name, properties, options);
@ -457,15 +451,3 @@ Registry.prototype.autoAttachModel = function(ModelCtor) {
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;
}
});

View File

@ -36,7 +36,6 @@ describe('loopback', function() {
'Change',
'Checkpoint',
'Connector',
'DataModel',
'DataSource',
'Email',
'GeoPoint',