[baseten-users] Using relationships with binding
Tuukka Norri
tuukka.norri at karppinen.fi
Wed Apr 22 15:54:03 EEST 2009
Hi!
Réjean Lamy kirjoitti 21.4.2009 kello 15.43:
> The first problem was with one-to-many relationship field and NULL
> value. I manually edited the table to allow the relationship field
> to accept NULL.
This is a bug in BaseTen Assistant (http://basetenframework.org/ticket/179
). It should be fixed in SVN trunk but we'd like to do some more tests.
> But now my second problem is about using relationship with binding.
>
> Is it correct with BX to use Array Controllers for the ManagerPopUP,
> EmployeeList (Department View) and DeptPopUp (Employee View) ?
Yes. You'll probably want to use BXSynchronizedArrayControllers,
though, since they are able to fetch objects from the database and
change their content based on notifications received from the database.
> Is It ok for these controllers to be in "Entity mode" with
> "Automatically Prepare Content ?
No. BXSynchronizedArrayController shouldn't even expose these options.
Instead, it does have an option called “Fetch on Connect”; it does
work quite the same way as Automatically Prepare Content, though.
> What is the correct binding for these controllers ?
They should be bound like in Hillegass's example. The Managed Object
Context binding isn't used (and isn't available), but databaseContext
outlet needs to be connected.
> What is the correct key path for a relationship ? (trying the Data
> Model name and the "other table" name don't work).
In BaseTen 1.6.2 one could use the target table's name to reference a
relationship, if that particular relationship is the only one between
the tables. Obviously this won't work in the Department-Employee
example. The foreign keys' names can also be used (see sections 2.2.1
and 2.2.2 in the manual), but for BaseTen 1.6.3 we changed this a bit
so that both the relationship's and the inverse relationship's name
will work as specified in the Xcode data model.
We'll probably add some functionality to list the relationships into
BaseTen Assistant. Meanwhile, there is a command-line tool called
Introspection in our source repository (see http://basetenframework.org/browser/trunk/Examples/Introspection)
for this purpose.
We'll write some more examples as soon as we're done with version 1.6.3!
--
Best regards,
Tuukka Norri
MK&C
More information about the baseten-users
mailing list