Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have created an entity that I want to collect data with from an external source and I want to reference that data to a node. How should i set up that entity in DB so it can properly reference a node? Can I use entity_id that references nid? And I want my entity to be non-fieldable so it does not take up unnecessary space and time.

Thanks.

share|improve this question
1  
The entity reference module provides a field, so you won't be able to use it with a non-fieldable entity. You can just store the node ID as an integer property on your entity, but obviously you won't get any of the entity reference UI goodness (autocomplete, using views to limit allowed choices, etc) – Clive Jul 3 at 10:06
The problem is that I only want one table that i have to insert data into, if I use the entity reference field there will be several places that I have to insert data into and that's the problem. I would like to just use one table and be able to reference that data to a node, is that possible? – Edd Clark Jul 3 at 11:10
The field system will take care of adding/updating/removing the field data, you won't have to (and shouldn't) manipulate those tables manually. It sounds a bit like you want to use half of the entity system, and half your own custom solution. I wouldn't advise trying to do that; if you want to use Drupal's entity system, use it fully. That includes using fields where appropriate, which they are in your case – Clive Jul 3 at 11:14
Thanks, I will try to use the entity reference module correct and see if that works good. – Edd Clark Jul 3 at 11:40
If I would like to add data from an external source to drupal DB is there any easy way to see what tables I should add that data into so the entity reference also will be created? – Edd Clark Jul 3 at 12:25

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.