On Sat, Sep 5, 2009 at 8:30 PM, Richard Somers
<rsomers.li...@infowest.com>wrote:

> I have a simple Core Data model with two entities, A and B. Each entity has
> several attributes but no relationships.
>
> I need a single array controller which contains all A and B objects in the
> model.
>
> In Interface Builder this works.
>
>     File's Owner (managedObjectContext)
>     A Array Controller (bind to File's Owner)
>
>     or
>
>     File's Owner (managedObjectContext)
>     B Array Controller (bind to File's Owner)
>
> But I can not figure out how to get this to work.
>
>     File's Owner (managedObjectContext)
>     Composite Array Controller (bind to File's Owner)
>     A Array Controller (bind somehow to Composite Array Controller)
>     B Array Controller (bind somehow to Composite Array Controller)
>
> Any help or insight would be appreciated.
>
> Richard
>
>
I'm understanding you correctly, you need to give up one or the other of
your conflicting design goals.

Based on the constraints you're implying, there is no way to do it. It
appears that you want the composite array controller to be configured to
support an entity, as opposed to a class. Of course that's not possible,
with the model as you've described it.

One solution would be to change your model to make the two entities inherit
from a common parent entity (internally, this means they are all in the same
SQLite table, if you use a SQLite store). The the composite AC can be
configured with the parent entity and the other ACs can be configured to
filter on entity.name = @"A"/@"B" or something.

Alternately, you have to synthesize your composite array in code as a
property of your File's Owner, and configure your composite AC to gets its
content array from there. The complexity there depends on whether you want
to support adding objects from your specialist ACs. It basically means
writing a glue layer.

-- 
Brent Gulanowski
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to