3

I might be barking up the wrong tree completely however I am trying to achieve the following.

  • Drupal 7.
  • Custom REST web service which can hold user definable content types.
    • These pieces of content are stored and revisioned at a entity level. (not at a field level like drupal)
  • I want to be able to use Entity API + Entity Model to define Content Types to store in the REST service.
  • When inserting DO NOT create the Drupal field tables.

When I hook_entity_insert the field tables are still being created. How can I prevent Drupal from creating these tables.

Also, does this sound like the best way to go about this? Is there an easier way to achieve using REST services and not duplicating data in the Drupal DB?

Thanks.

2 Answers 2

2

This is achieved by creating a custom Entity Controller class, extending either the DrupalDefaultEntityController or creating a DrupalEntityControllerInterface implementation.

Then create a field storage engine, using the Field Storage API and attach the correct fields where required.

I used the MongoDB mongodb_field_storage module for reference.

This all works as expected, and I do not use the Drupal database to store any Entity Metadata or field data. Only the field_config table is used.

The only hiccup I have is that the Drupal 7 'Per Field' storage engine actually needs to be defined in the variable table setting the field_storage_default to your custom storage engine. I have yet to find a way to hook into this on a per field basis without patching core. See here for more details.

1
  • Any chance you could post a link to some sample code? Commented Jul 20, 2012 at 1:28
1

It looks like there are now two (2) modules that allow for remote data storage:

There's a good write-up on these and other options over at What is the most reliable and fault tolerant way to integrate 3rd-party data structures via a web service in Drupal 7?.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.