From d179ae1039b2d47a59f2d064c40ac1780b5f68e4 Mon Sep 17 00:00:00 2001 From: Stanley Stuart Date: Tue, 16 Jun 2015 10:11:01 -0500 Subject: [PATCH] deprecate store.filter --- packages/ember-data/lib/system/store.js | 7 +++++++ packages/ember-data/tests/integration/filter-test.js | 6 ++++++ tests/ember-configuration.js | 1 + 3 files changed, 14 insertions(+) diff --git a/packages/ember-data/lib/system/store.js b/packages/ember-data/lib/system/store.js index 9e28bf97b1e..6716b3e7fd1 100644 --- a/packages/ember-data/lib/system/store.js +++ b/packages/ember-data/lib/system/store.js @@ -1339,6 +1339,13 @@ Store = Service.extend({ */ filter: function(modelName, query, filter) { Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string'); + + if (!Ember.ENV.ENABLE_DS_FILTER) { + Ember.deprecate('The filter API will not be enabled by default in Ember Data 2.0 as it will be undergoing heavy churn. To enable it, or to use an alternative, you can visit the deprecation guide', false, { + url: 'https://github.com/ember-data/ember-data-filter' + }); + } + var promise; var length = arguments.length; var array; diff --git a/packages/ember-data/tests/integration/filter-test.js b/packages/ember-data/tests/integration/filter-test.js index efc1a983bf2..7ca97b5eba3 100644 --- a/packages/ember-data/tests/integration/filter-test.js +++ b/packages/ember-data/tests/integration/filter-test.js @@ -1,5 +1,7 @@ import customAdapter from 'ember-data/tests/helpers/custom-adapter'; +var oldEmberENV = Ember.EmberENV; + var get = Ember.get; var set = Ember.set; var forEach = Ember.ArrayPolyfills.forEach; @@ -18,6 +20,9 @@ var shouldNotContain = function(array, item) { module("integration/filter - DS.Model updating", { setup: function() { + Ember.EmberENV = { + ENABLE_DS_FILTER: true + }; array = [{ id: 1, name: "Scumbag Dale", bestFriend: 2 }, { id: 2, name: "Scumbag Katz" }, { id: 3, name: "Scumbag Bryn" }]; Person = DS.Model.extend({ name: DS.attr('string'), bestFriend: DS.belongsTo('person', { inverse: null }) }); @@ -25,6 +30,7 @@ module("integration/filter - DS.Model updating", { store = env.store; }, teardown: function() { + Ember.EmberENV = oldEmberENV; run(store, 'destroy'); Person = null; array = null; diff --git a/tests/ember-configuration.js b/tests/ember-configuration.js index 6278c32855f..21b78af7145 100644 --- a/tests/ember-configuration.js +++ b/tests/ember-configuration.js @@ -11,6 +11,7 @@ var extendPrototypes = QUnit.urlParams.extendprototypes; ENV['EXTEND_PROTOTYPES'] = !!extendPrototypes; + ENV['ENABLE_DS_FILTER'] = true; // Handle testing feature flags ENV['ENABLE_OPTIONAL_FEATURES'] = !!QUnit.urlParams.enableoptionalfeatures;