A tip regarding many-to-many relationships in Transfer
In Transfer, you use an XML configuration file to describe your database tables and the relationships between them. You can define three types of relationships: one-to-many, many-to-one, and many-to-many.
The many-to-many relationship is used when one table is related to another table through the use of a linking table. In the introductory Transfer example files I looked at today, the many-to-many example is an application with an Events table, a Categories table, and an Events-Categories table containing a foreign key field referring back to the Events table primary key field, and a foreign key field referring back to the Categories table primary key field.
Now, when you define a one-to-many or many-to-one relationship between two tables, you describe both tables in the Transfer configuration files: they each have their own <object> XML block so Transfer objects can be created based on them. What I did not realize until today, when I looked more closely at those example Transfer files, is that you DO NOT create an <object> XML block for the linking table. The many-to-many relationship that you describe within one of other two tables' <object> block tells Transfer all it needs to know to relate the two tables.
Now, if I had read the Transfer documentation more carefully, or if I had tested my Transfer configuration file either against the included schema file or with testing code as I made changes to it, I probably would have figured this out a lot faster. But because I didn't do either of those things, I was baffled by the inscrutable and inconsistent error messages returned by my application when I started working on the CRUD operations involving those tables.
So in addition to the tip itself, my other piece of advice is to take your time and carefully read (and think about) the documentation when you start working with a new framework like Transfer: it may be easy to get started with, but you might miss a subtle detail or two that can get you in trouble.

There are no comments for this entry.
[Add Comment]