Re: Multi Multi problems (was a null subject)
[prev]
[thread]
[next]
[Date index for 2005/04/28]
First off, sorry about the empty subject line.
Jay Strauss wrote:
> Jonathan Steinert wrote:
>
>> I'm trying to build a relatively simple object relationship, two tables
>> containing the following (to start)
>>
> ...
> I wonder if your having a hard time because of primary keys. That is
> maybe you should define the "edges" table like
>
> ID
> Child
> Parent
>
> Then you could use a single "Vector" class with 2 has_a's, one along
> the parent and one along the child.
I tried doing it originally as a single object pointing both ways, but
as a multi column primary key I have no way of controlling which column
the has_many() lookup from the node uses as the lookup key. Basically
what was happening was the lookup would work properly in one direction,
but then it would lookup according to the same column the next time and
return the other column. In other words I would get the same result set
for both a 'parents' and 'children' call, but it would return the
corresponding columns, making it look as if the current node has the
same number of parents as children and all of the parents as itself.
>
> Otherwise if you define the Vector table with a multi key primary key
> (MKPK), I think you'll run into a bug about having an MKPK and has_a's
> on the pk columns
There is a bug regarding MKPK and has_a on the PK columns? This idea is
shown in the documentation as working. (see the Multi to Multi section
for the example)
>
> Jay
>
I'm turning on DBI_TRACE and see if I can see what's going wrong.
|
Jonathan Steinert 09:21 on 28 Apr 2005
|
|
|
Re:
Jay Strauss 13:26 on 28 Apr 2005
|