[SOLVED] (again) How to observe every child entity
[SOLVED] (again) How to observe every child entity
- Subject: [SOLVED] (again) How to observe every child entity
- From: Matthew Lindfield Seager <email@hidden>
- Date: Wed, 30 Sep 2009 13:01:16 +1000
Jim Correia wrote:
> What you are talking about is not observing child entities. You wish to
> observe related instances (NSManagedObject or subclass thereof). The entity
> describes the instance, but is not the instance.
>
You're right and I don't think that's overly pedantic. OTOH I was just
trying for a succinct subject that covered my intent. I think my usage was
appropriate in the actual content of the post.
Jerry Krinock wrote:
> I don't think you want to do that. When I had similar issues a few months
> ago [1] I decided that the solution was Custom Setters.
Thanks Jerry! To work around the bug you pointed out I'm now storing the
balance property as a regular attribute and updating it every time the
transactions relationship or a related transaction amount changes (using
custom setters).
FWIW, my original question bit me again but eventually I figured out what I
was doing wrong (and slapped myself)... When I originally asked why
add/removeTransactionsObject: and add/removeTransactions: weren't getting
called by the array controller I completely overlooked the inverse of that
relationship.
The inverse relationship was getting set by a "child" object and Core Data
was automagically taking care of the parent's to-many relationship without
calling my custom
setters. I bet you that behaviour is even documented somewhere! ;-)
Thanks everyone!
Matt
Safe, comfortable and satisfied? Consider supporting some people who aren't!
I'm riding 100 kilometres to raise funds for refugees!
http://my.e2rm.com/personalPage.aspx?registrationID=750445
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden