Skip to content

Commit

Permalink
Only fetch from a query's mapped source
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultz committed Sep 22, 2011
1 parent b33bf3f commit f0d9fb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
30 changes: 14 additions & 16 deletions src/mesh/model/source/FixtureSource.as
Expand Up @@ -64,23 +64,21 @@ package mesh.model.source
*/
override public function fetch(request:AsyncRequest, query:Query):void
{
if (query.entityType == _entityType) {
var entities:Array = [];
for each (var hash:Object in _fixtures) {
var entity:Entity = newInstance(_entityType);
entity.fromObject(hash);
entities.push(entity);
}

if (query is RemoteQuery) {
entities = entities.filter(function(entity:Entity, ...args):Boolean
{
return query.contains(entity);
});
}

request.result(new ArrayList(entities));
var entities:Array = [];
for each (var hash:Object in _fixtures) {
var entity:Entity = newInstance(_entityType);
entity.fromObject(hash);
entities.push(entity);
}

if (query is RemoteQuery) {
entities = entities.filter(function(entity:Entity, ...args):Boolean
{
return query.contains(entity);
});
}

request.result(new ArrayList(entities));
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/mesh/model/source/MultiSource.as
Expand Up @@ -85,9 +85,7 @@ package mesh.model.source
*/
override public function fetch(request:AsyncRequest, query:Query):void
{
for each (var source:Source in _mapping) {
source.fetch(request, query);
}
sourceFor(query.entityType).fetch(request, query);
}

/**
Expand Down

0 comments on commit f0d9fb3

Please sign in to comment.