Drupal 7 entities
I've just spent the good part of the day trying to get my head around how the database in Drupal 7 works, I think I'm close, and here are some notes from my travels.
This is a good starting point to jump right into an example:
http://www.commerceguys.com/resources/articles/183
http://drupal.org/node/916776#comment-4344024
I'd recommend this high level article as worth a read for those trying to get a grasp on the new Drupal 7 way of doing things at a DB level.
http://www.istos.it/blog/drupal/drupal-entities-part-1-moving-beyond-nodes
My two cents is that many of the examples in the main doco seem to be aimed at core developers, but this is not clear because in D6 we used to have to write SQL queries that pretty much did stuff like this:
http://drupal.org/node/310075#joins
Topics like the following show joins with entity_id, ok to do this if you are writing a views type module, but imagine writing that join for your own code! Crazy!
http://drupal.org/node/992704
By now I would think (most?) Drupal users would be using CCK and the doco doesn't (well not obviously anyway) point to the "correct?" way of querying the database which I think would be to use EntityFieldQuery (isn't it?)
http://api.drupal.org/api/drupal/includes--entity.inc/function/EntityFieldQuery%3A%3AentityCondition/7
Comments