Thanks Chuck,
Merging our last couple of posts: It does work!!
I'm not sure that it should.
You're killing me! I suspected it wouldn't work which is why I posted the clarifications before I tried it. I just substituted the applicationUsers key and it "just worked". Here's the code:
/** @TypeInfo Meeting */ public NSArray meetingRepetition() { ApplicationUser applicationUser = (ApplicationUser) valueForKeyPath("session.user"); EOEditingContext ec = applicationUser.editingContext(); return EOUtilities.objectsWithQualifierFormat(ec, "Meeting", "applicationUsers = %@", new NSArray(applicationUser)); }
Two clarifications: one is that Meeting <-> ApplicationUser is many to many.
Well, that does make it more tricky. EOF does not come with a "users contains %@" for qualifying against to-many relationships. There are options. I suspect that Project Wonder has one. It seems to have at least one of everything. :-) You can also use one of Pierre Bernards very clever qualifier extensions found at:
So now I have no idea why the applicationUsers accepted one ApplicationUser as the argument.
What is the difference between using the code as you gave me and using the binding out of WOBuilder?
Um, which binding are we talking about?
The "session.user.meetings" variable that I dragged from the lower part of WOBuilder to the list item of my WORepetition.
Using the binding seems to delay updating for quite awhile on the display side, while using the EOUtilities method updated immediately.
Sounds like your "binding" is caching something.
I'll buy that.
The second is that I am trying to get the fresh data with a fetchspec.setRefreshesRefetchedObjects(true)
Seeing as how I am lost in the weeds, let me take a step back. What are you trying to refresh? We need to make a distinction between 1) Which objects are in the relationship (e.g. have some attendees been added or removed?)
No change to users. Ideally the user logs in, makes a change to the meetings schedule. Goes to his home page and sees the updated meeting information.2) The attributes of the objects in the relationship (e.g. meeting time was changed?)
Exacty. For example: Makes a new meeting and invites participants. Changes a time or location for the meeting.
A refreshing fetching will refresh the data for (2) but not (1).
So given that the EOUtilities code shouldn't have worked, can I use a fetch spec for this?
|