When are relationships to the linking table updated?
When are relationships to the linking table updated?
- Subject: When are relationships to the linking table updated?
- From: Kaj Hejer <email@hidden>
- Date: Mon, 5 Jan 2004 16:19:16 +0100
Hi!
I have a feeling that I should know the answer to this question
myself :) but anyway:
When is the relationships to the linking table for a flattend
many-to-many relationship updated?
It seems to me that the flattend relationship is updated before I
save changes if I use removeObjectFromBothSidesOfRelationshipWithKey
/ addObjectToBothSidesOfRelationshipWithKey on the flattend
relationship (which is as I would expect it to be), but not the
relationships between the objects at each side to the linkingtable (I
would expect these relastionships to be updated too).
They are not updated until after I save changes and refresh the the
objects on each side.
Background:
I have a linkingtable for a many-to-many relationship which is flattend:
Persons <->> PersonsCars <<-> Cars
I want remove the relationship between a person and a car with
aPerson.removeObjectFromBothSidesOfRelationshipWithKey(aCar, "cars");
and aPerson.cars() and aCar.persons() get updated.
So far so good :)
I have an attribute in the linkingtable in addition to the personID
and carID that I need access to.
That is why I in a editpage want to iterate over aPerson.personsCars
instead of aPerson.cars.
But if I add or remove relationships between cars and persons
aPerson.personsCars is not updated until at have saved and refreshed
aPerson.
I have tried to call aPerson.editingContext().processRecentChanges()
but that don't seems to update the aPerson.personsCars array.
I know I can find some worarounds for this issue, but I got a bit
curious on when these relationships got updated.
-Kaj :)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.