Given a "node-like" database table in an "external" or "secondary" database, what's the easiest way to expose them as entities?

Documentation for the entity module makes it seem easy for data stored in the local database, but I'm not sure how that can be translated to another db.

  • I assume you need proper fields so you can interact with the rest of Drupal?
    – mpdonadio
    Dec 5, 2012 at 18:42
  • I'll take what I can get :) If I can expose more data as fields, that's great.
    – Letharion
    Dec 5, 2012 at 18:46
  • Depending on where the external datasource is that might introduce a bit of a lag...could you just define or re-use an existing entity type and write something (e.g. a class for the migrate module) to sync entities on a schedule?
    – Clive
    Dec 5, 2012 at 19:00
  • I'm currently looking at this video which promises to answer my question: blip.tv/drupalcondenver/…
    – Letharion
    Dec 5, 2012 at 19:27

1 Answer 1


Some googling has revealed that the easiest solution is

  1. Declare a new entity
  2. Create a new Controller class for it that knows how/where to apply data operations.
  3. Declare all your metadata as properties as opposed to fields.

I hope I'll be able to expand on this answer once I actually try it out. :)

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.