Entity API

To be short

An entity type is a base class
A bundle is an extended class
A field is a class member, property, variable or field instance (depending on your naming preference)
An entity is an object or instance of a base or extended class


Entity types

In earlier versions of Drupal, the field system was only used on content types. Now, thanks to the Entity API, we can add fields to other things, like comments. An entity type is a useful abstraction to group together fields.
Some examples of entity types:

  • Nodes (content)
  • Comments
  • Taxonomy terms
  • User profiles

You can also build new kinds of entity types where the options above don't suit your needs.


Bundles are an implementation of an entity type to which fields can be attached. With content nodes (an entity type), for example, you can generate bundles (subtypes) like articles, blog posts, or products.
Not all entity types have bundles, however. For example, users do not have separate bundles (subtypes).
For the entity types that do allow bundles, you can create as many bundles (subtypes) as you want. Then, using the Field system, you can add different fields to each bundle. Examples include a file download field on Basic Pages and a subtitle field on Articles.


Each field is a primitive data type, with custom validators and widgets for editing and formatters for display. Fields can be added to any of the bundles (or entity types) to help organize their data.


An entity would be one instance of a particular entity type (comment, taxonomy term or user profile) or a bundle (blog post, article or product).

You can use entity_load to load any entity. Note, however, that the core does not provide a save or delete function, but thanks to Entity API module the missing pieces are added (entity_create(), entity_save(), entity_delete(), entity_view() and entity_access()).



Entity API Tutorial




http://joshaust.in/2012/06/entities-and-bundles-in-drupal-7/  (http://joshaust.in/wp-content/uploads/2012/06/Entities-and-Bundles-in-Dr...)