Re: Searching for an entity in a relationship (CoreData)?
Re: Searching for an entity in a relationship (CoreData)?
- Subject: Re: Searching for an entity in a relationship (CoreData)?
- From: Mike Nowak <email@hidden>
- Date: Sun, 4 Dec 2005 02:22:50 -0500
Thanks! You were right -- I did have an ArrayController with delete
objects on removal turned off. Once I had that turned on, I just had
to turn off Cascade for the inverse relationship and it worked as
expected. Thanks again!
On Dec 3, 2005, at 10:57 PM, Chris Hanson wrote:
On Dec 3, 2005, at 7:45 PM, Mike Nowak wrote:
But then I noticed it would get data for a year I had deleted in
the UI. I tried changing the fetch request to use year == $year
and stock = nil but that didn't make a difference. When I save the
data in XML format, I can see that the Stock only lists the
YearData entities I expect but the deleted YearData entity still
points to the Stock entity. (I was surprised to see the deleted
YearData entity in the saved file at all.) I tried various delete
rules to unhook the deleted entity but to no avail.
A couple things come to mind. First of all, if your relationship
maintenance is messed up even though you have inverses, I suspect
you have a no-action delete rule somewhere. If you want deleting a
YearData to delete the objects on the other side of its stock
relationship, use a cascade delete rule on the stock relationship.
Also, if the YearData objects are still in the file, it sounds like
they were only removed from relationships rather than deleted.
This could be the case if you have YearData being shown in a table
view managed by an NSArrayController that gets its data from a
contentSet binding. The contentSet binding has a setting to
indicate whether it should delete objects upon their removal; I
believe this is off by default.
-- Chris
--
Mike Nowak
Work:
http://healthmedia.umich.edu/
Personal:
http://snackdog.org/
"Better out than in."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden