No tab for child table with many-to-many relationship

Archived from the Xataface Users forum.

rdb — Sat Mar 07, 2009 2:15 pm

I’ve created a many-to-many relationship between two tables using a join table. When I view the parent table in XF, I don’t get the tab for the child table displayed.

Here’s the setup:

Parent table: ‘people’ with primary key ‘id’

Child table: “research_area” with primary key ‘id’

Join table: “research_area_member” with two fields:

people_id

research_area_id

which together are set as the primary key.

I have a relationships.ini file in tables/people that contains the following:

Code: Select all
[areas] __sql__ = "SELECT *       FROM research_area_member ram       INNER JOIN research_area ra ON ram.research_area_id = ra.id       WHERE ram.people_id = $id"

I also tried replacing the __sql__ statement in the relationships.ini file with:

Code: Select all
research_area.id = research_area_member.research_area_id research_area_member.people_id = $id

but the result was the same; no tab to “areas” when listing/editing entries in the ‘people’ table.

I’m running mysql 5.0.45-7 under Red Hat EL 5. I’ve tried this with:

Xataface 1.0.7 561, and

Xataface 1.1.5r2 984

Any ideas of what might be going awry would be appreciated.

Cheers,

Richard


rdb — Sun Mar 08, 2009 10:42 am

Doh!

Permissions problem….. never mind.


mico — Mon Mar 30, 2009 2:18 am

rdb,

I am getting the same problem when adding a normal relation … no tab it seems same as your problem. Can you explain how you solved it?

Thanks,

Mico


fongchun — Thu Apr 02, 2009 9:14 am

Mico,

It can be as simple as setting the condition attribute of the relationship to be false. If you want help, can you post a little more details of your code? (ie, the exact relationship in the relationship.ini file and other helpful information)