[Composition] Return newly-contextualized object

After adding to composition, return the newly-contextualized
object; this is regularly used by other services.
This commit is contained in:
Victor Woeltjen
2015-09-02 11:37:47 -07:00
parent ba6e542d08
commit b1238b0c96
3 changed files with 26 additions and 19 deletions

View File

@@ -68,10 +68,10 @@ define(
}
}
return composition.add(object).then(function () {
return parentObject.getCapability('persistence').persist();
}).then(function getObjectWithNewContext() {
return composition.invoke().then(findChild);
return composition.add(object).then(function (result) {
return parentObject.getCapability('persistence')
.persist()
.then(function () { return result; });
});
};