Hi,
I use the deepCopy method described in "Practical Web Objects" (every WO
developer should have one :-) ).
Enumeration relationshipEnumerator =
publicRelationships.objectEnumerator();
EORelationship aRelationship;
while (relationshipEnumerator.hasMoreElements()){
aRelationship = (EORelationship)
relationshipEnumerator.nextElement();
if (aRelationship.isToMany()) {
// Copy each element of the to-many array
NSArray relatedObjects = (NSArray)
original.valueForKey(aRelationship.name());
for (int i = 0, count = relatedObjects.count(); i <
count; i++)
...
This work fine if the relationship method is the original generated:
getFoo() { storedValueForKey("foo"); }
But if i override it in the subclass like:
getFoo() {
NSArray array = super.getFoo();
if (array != null && array.count() > 0) {
// hint: _collationArray use
EOSortOrdering.sortArrayUsingKeyOrderArray on instances of NSMutableArray
array = _collationArray(array, _Foo.KAUFLAGE + "." +
_KAuflage.ORDERBY_KENNZEICHEN);
}
return array;
}
all get messed up.
To get totally confused if I use:
// Copy each element of the to-many array
NSArray relatedObjects = new NSArray((NSArray)
original.valueForKey(aRelationship.name()));
int count = relatedObjects.count();
for (int i = 0; i < count; i++) {
...
in deepCopy the copy semes to be ok.
Can anyone explain why ?
Stefan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]