[Creation] createObject returns newObject
createObject returns a promise which is resolved when the object has been persisted. The promise is resolved with an instance of the new domainObject.
This commit is contained in:
@@ -77,7 +77,19 @@ define(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return parentPersistence.persist();
|
||||
return parentPersistence.persist().then(function () {
|
||||
// Locate and return new Object in context of parent.
|
||||
return parent
|
||||
.useCapability('composition')
|
||||
.then(function (children) {
|
||||
var i;
|
||||
for (i = 0; i < children.length; i += 1) {
|
||||
if (children[i].getId() === id) {
|
||||
return children[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,4 +138,4 @@ define(
|
||||
|
||||
return CreationService;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user