0

So we have a simple mysql database that stores information about people, which is used by multiple sites on our environment. I'd like to use entities to interact with this database, but I can't figure out an easy way to tell the Entity API to use this database for the entity without overriding a bunch of stuff in Entity API with db_set_active('test'); and then db_set_active();, which seems really clunky and like it will cause someone to seriously resent me (possibly future-me) when they work on this down the road. Is there a more elegant solution to this?

  • Exactly how do you want to interact with the remote db? Do you want to store the entities there (in a drupal fashion)? You know entities are "broken up" across table(s) per field -- it'd be nightmare for remote systems not using the Entity API to interact with these entities directly ... – tenken Dec 2 '14 at 20:12
  • you would need to have that other db setup exactly as it is in the Drupal db or it will crash. Otherwise, you need to rewrite entities to conform to the setup of the other db and translate the information into something Drupal can recognize – Geoff Dec 2 '14 at 20:21
  • Storing the entities there- I'm going to restructure it to match what the entity system wants. – Melissa Dec 2 '14 at 20:59
  • since you're restructuring it, why not just have the other site interact with a standard Drupal db? I fail to see any advantage in this sort of set up... – Geoff Dec 3 '14 at 3:42
  • It's shared between some Drupal sites that aren't multisite, as well as another php-based site. – Melissa Dec 3 '14 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.