Merge pull request #1988 from strongloop/feature/remove-data-model

[SEMVER-MAJOR] Remove "loopback.DataModel"
This commit is contained in:
Miroslav Bajtoš 2016-01-25 10:21:07 +01:00
commit 18da6993d9
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,14 +107,8 @@ 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);
}
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);
}
};
// 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',