Re: DB_DataObject 2 joins to same table
| From: | Justin Patrin | Date: | Mon, 29 Nov 2004 23:10:42 +0000 |
| Subject: | Re: DB_DataObject 2 joins to same table | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15909@lists.php.net to get a copy of this message | ||
On Mon, 29 Nov 2004 15:05:22 -0800, Ken Restivo <ken@restivo.org> wrote:
> On Mon, Nov 29, 2004 at 09:49:17AM +0100, Leo M?rquez wrote:
> > [USER]
> > user_id (pk)
> > user_name
> > user_firstcar
> > user_secondcar
> >
>
> I don't know PEAR very well, but it seems that the "right" way to do the table
> from a relational DB standpoint is something like:
>
> [USER]
> user_id
> user_name
>
> [USER_CAR_JOIN]
> user_car_join_id (pk)
> user_id
> car_id
>
> [CAR]
> car_id (pk)
> car_name
> car_color
> car_model
>
> Another advantage is that you can have more than 2 cars without having to change your DB schema
> and all your forms.
>
> Although I find *visually* presenting this kind of relationship really, really hard in
> FormBuilder. My application is structured like this, and I've been banging my head against the
> wall trying to find a clean way to design forms that deal with this kind of schema.
>
It's called a crossLink. ;-)
http://opensource.21st.de/tiki-index.php?page=Formbuilder+configuration+options#id598583
--
Justin Patrin