Skip to content

Commit

Permalink
scoping loadRequest function to entity that it's defined within
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultz committed Apr 25, 2011
1 parent d9baede commit 6aa3651
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mesh/model/associations/Association.as
Expand Up @@ -110,7 +110,7 @@ package mesh.model.associations

if (!isLoaded) {
callback("beforeLoad");
_loadRequest = definition.hasLoadRequest ? definition.loadRequest() : createLoadRequest();
_loadRequest = definition.hasLoadRequest ? definition.loadRequest.apply(owner) : createLoadRequest();
_loadRequest.addHandler({
success:function():void
{
Expand Down
8 changes: 7 additions & 1 deletion src/mesh/model/associations/AssociationCollection.as
Expand Up @@ -34,7 +34,7 @@ package mesh.model.associations
object = [];

afterLoad(loaded);
beforeAdd(populateInverseAssociation);
afterAdd(populateInverseAssociation);
}

/**
Expand Down Expand Up @@ -204,6 +204,8 @@ package mesh.model.associations
{
if (definition.hasInverse) {
if (entity.hasOwnProperty(definition.inverse)) {
// if the inverse relationship is an association, then we populate the inverse
// association's object. otherwise, we just set the property to the association's owner.
if (entity[definition.inverse] is Association) {
entity[definition.inverse].object = owner;
} else {
Expand Down Expand Up @@ -370,6 +372,10 @@ package mesh.model.associations
value = value.toArray();
}

for each (var entity:Entity in value) {
callbackIfNotNull("beforeAdd", entity);
}

super.object = new ArrayCollection(value);

if (_mirroredEntities == null) {
Expand Down

0 comments on commit 6aa3651

Please sign in to comment.