Very new to Drupal and have a strong SQL database development background so those with both can probably best understand my question. I am looking for the BEST way to relate content types to each other and I'm thinking of content types the way I think of database tables.

For example, I have a company, division, and department content type and all of these content types have fields associated with them. A division needs to be associated to a single company and a department needs to be associated to a single division. Here is what I want to do.

Create all of my company records (nodes??). When I create my division nodes, I want to choose a company name to associate with the division when I create the content. In a view of some sort, when I display a division and all of its fields, I also want to be able to display the company associated with the division and any of the company fields. The same goes with the division/department relationship.

I'm thinking about these relationships the same way I'd think about referential integrity between related tables in a database. Does this paradigm exist in Drupal and how difficult is it to implement? Can anybody walk me through how to do this or point me to any articles or related video tutorials?

I have looked through the forums and the Drupal site and have seen reference and relation modules, but the documentation came up short on how to actually implement this. The site I want to build is fairly straightforward, but alot of it depends on how this concept is implemented.

Thanks!

Comments

cfox612’s picture

It sounds like you're looking for the Entity Reference module.

ishworthapaliya’s picture

Hi!

This can be done using Entity reference (https://drupal.org/project/entityreference).

Linking the contents

Using Entity Reference in Views

Hope this helps.

Ishwor

dbdrupal’s picture

Thanks for the suggestions. I will take a look at this tonight and see if I can get this to work the way I'm hoping it will. Will report back.

rexfordnyrk’s picture

Please I will like to know if you were able to implement it. same here I have similar background and in a similar situation not knowing exactly where to start or how to achieve this. Can you kindly point me in the right direction or anyway you might have achieved it?.