Welcome, Guest
Username: Password: Remember me

TOPIC: Specifying Foreign Key

Specifying Foreign Key 02 Mar 2013 16:23 #6885

  • dlinney
  • dlinney's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
I have searched on foreign key but I am a little behind where the other questions are. I cannot link my foreign key to the relevant table field.

For example I define a table of 'booking types' with just a string field. I can populate this with values (e.g. 'coaching', match', 'practice'.

I then want to have a 'booking' table that includes the booking type. I add a foreign key field to that table and drag the 'booking type' table to that field. But I only get BookingType > id when I run it. I don't seem to be able to specify the key field from 'bookingtype' in the 'booking' table that I want?

I think I'm missing a step as previous messages talk about dragging the fieldname to the foreign key but I don't see this field name only the table name.
Last Edit: 02 Mar 2013 16:25 by dlinney. Reason: typo
The administrator has disabled public write access.

Re: Specifying Foreign Key 02 Mar 2013 17:41 #6886

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi and welcome!

please see this post: www.j-cook.pro/forum/25-faq/3850-linking-tables#3854

hope it helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Specifying Foreign Key - solved 02 Mar 2013 18:45 #6892

  • dlinney
  • dlinney's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
OK, my error as a newbie.

In Database systems I have always specified the table and table linkage (foreign keys) in the database schema so I thought it would be done in the tables section. But having read the tutorial I now see that it is in the Layouts that the connection gets made.

Have managed to get villes, voayageurs and voyages working.

Very impressed so far with the system.
The administrator has disabled public write access.

Re: Specifying Foreign Key - solved 02 Mar 2013 19:42 #6893

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Sure, in a ground-up app/site I suppose you may well go that route. However, in most cases, components intended for Joomla would generally let a table class (OOP) handle routines such as saving, deleting etc as its more flexible to work with. This allows 'joomla' (and its extensions via inheritance) to intercept these routines to manipulate them; for instance, with routines such as publishing, locking of records with 'checked-out' and so on.

Checkout some of the wizards... @admin has crafted a real gem!!!
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
Time to create page: 0.088 seconds

Get Started