One-to-many problem

0 views
Skip to first unread message

EJ Jaquet

unread,
Sep 26, 2009, 4:32:01 AM9/26/09
to transfer-dev
Hi all,

I have a question on how to solve a problem with one-to-many's. I have
a user table, a task table and a contact table.

Both the contact table and the task table have a assigned-to-user,
modified-by-user and created-by-user, which point to the user table.
All fields are foreign keys to the user.userid field.

How do I put this in my Transfer file? I have created all the one-to-
many's like this: <onetomany name="task_created_by">
<link to="task.task" column="created_by_user_id" />
<collection type="array" >
<order property="subject" order="asc" />
</collection>
</onetomany>
<onetomany name="task_assigned_to">
<link to="task.task" column="assigned_user_id" />
<collection type="array" >
<order property="subject" order="asc" />
</collection>
</onetomany>
<onetomany name="task_modified_by">
<link to="task.task" column="modified_user_id" />
<collection type="array" >
<order property="subject" order="asc" />
</collection>
</onetomany>

But then I get a parentuser that only holds the last userid, the
modified-user.

I want to have the task that are assigned to a user available, and i
need to know which user is assigned to a task, so I think I need the
one-to-many relationship.

How do you guys handle this?

Erik-Jan

Mark Mandel

unread,
Sep 26, 2009, 4:39:05 AM9/26/09
to transf...@googlegroups.com
Sounds like a many to one relationship

Many Tasks have one User.

No?

Mark
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Erik-Jan Jaquet

unread,
Sep 26, 2009, 9:20:08 AM9/26/09
to transf...@googlegroups.com
Hi Mark,

The manytoone relationship does work, but I need to know which tasks are assigned to a user. And with a many to one I just get the user methods in the taskobject, but no task data in the user object.

How do I go about that?

Erik-Jan

2009/9/26 Mark Mandel <mark....@gmail.com>

Matt Quackenbush

unread,
Sep 26, 2009, 10:46:34 AM9/26/09
to transf...@googlegroups.com
Add a dwcorator method that looks them up. 

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages