Access the store finder _findQuery in ember-cli -
i need override ds.store.findquery
in ember cli. no problem in itself.
the problem importing _findquery method 'finder' file -- in new app/store.js file
this._findquery doesnt work
https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/store.js
in 'shimmed' component/ember-data prototype
function ember$data$lib$system$store$finders$$_findquery(adapter, store, typeclass, query, recordarray
has advice on required import statement.
here failed attempts
import ds 'ember-data'; import ember 'ember'; //import _findquery 'ember-data/lib/system/store/finders'; nope //import _findquery 'ember-data'; nope export default ds.store.extend({ findquery: function(typename, query) { var type = this.modelfor(typename); var array = this.recordarraymanager .createadapterpopulatedrecordarray(type, query); var adapter = this.adapterfor(type); ember.assert("you tried load query have no adapter (for " + type + ")", adapter); ember.assert("you tried load query adapter not implement `findquery`", typeof adapter.findquery === 'function'); var x = _findquery(adapter, this, type, query, array); // <-- urgh here return promisearray(x); },
i'm not sure able import in way describe, on adapter though.
you should able override per adapter, or if want everywhere, override on application adapter.
like this
import ds 'ember-data'; import ember 'ember'; export default ds.activemodeladapter.extend({ findquery (typename, query) { // stuff here } });
Comments
Post a Comment