CoreData Relationships and Array Controllers
CoreData Relationships and Array Controllers
- Subject: CoreData Relationships and Array Controllers
- From: Amy Gibbs <email@hidden>
- Date: Sun, 02 Oct 2011 18:37:07 +0100
Hi,
I've got a CoreData application that has a number of related entities.
I'd like to select 1 instance of 1 entity, and be able to display in a
table the resulting array of a number of relationships. I'm having
trouble trying to make it make sense in words so please bear with me.
The section I am dealing with has 4 entities, each one is linked to
the next with a to many relationship.
Customer (related to next by customerOrders)
CustomerOrders (related to next by customerOrderItems)
CustomerOrderItems (related to next by orderItemProduct)
Product
I'd like to select a customer, and see all the products they have
purchased over all their orders.
Is this possible? What is the easiest way to accomplish this? I have
tried creating additional array controllers but I just get errors, a
variety of different ones depenind on how I try to bind everything.
I thought I could create a new array controller (customerBookcase) and
bind it to the selection of the customers array controller, then bind
my table column to the customerBookcase array controller and step
though the relationships with the binding, so I tried to bind the
table column to the customerBookcase array controller, arranged
objects, orderItemProduct.productTitle (orderItemProduct is the
relationship between CustomerOrderItems and Product). The
customerBookcase array controller was bound to Customer, selection,
customerOrders. The error I get with this is:
[<NSManagedObject 0x1c0960> addObserver:<NSTableBinder 0x1c76a0>
forKeyPath:@"orderItemProduct.productTitle" options:0x0 context:0x0]
was sent to an object that is not KVC-compliant for the
"orderItemProduct" property.
2011-10-02 18:36:03.409 usborne[22004:10b] [<NSManagedObject 0x1c0960>
valueForUndefinedKey:]: the entity CustomerOrders is not key value
coding-compliant for the key orderItemProduct.
2011-10-02 18:36:03.969 usborne[22004:10b] [<NSManagedObject 0x1c0960>
valueForUndefinedKey:]: the entity CustomerOrders is not key value
coding-compliant for the key orderItemProduct.
2011-10-02 18:36:04.534 usborne[22004:10b] [<NSManagedObject 0x1c0960>
valueForUndefinedKey:]: the entity CustomerOrders is not key value
coding-compliant for the key orderItemProduct.
2011-10-02 18:36:05.011 usborne[22004:10b] [<NSManagedObject 0x1c0960>
valueForUndefinedKey:]: the entity CustomerOrders is not key value
coding-compliant for the key orderItemProduct.
Many thanks for any help,
Amy Gibbs
_______________________________________________
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