Last updated February 27, 2014. Created by Berdir on August 30, 2013.
Edited by guru4vedi, jhodgdon. Log in to edit this page.

If you are looking for the documentation or the entity API in Drupal 7, click here.

The entity system in Drupal 7 was introduced very late in the development cycle and only standardized how entities were loaded. The contributed entity.module built on top of it and added support for saving and deleting entities and many other APIs as well. Many of these improvements are now included in Drupal 8.

Below is a short overview of the entity system in Drupal 8, each part is documented on separate sub-pages.

Entities are now typed classes with methods. There are generic methods like $entity->id() and entity type specific methods like $node->getTitle(), all of them defined and documented in interfaces.

Entities are supported by controllers (to be renamed to ?handlers?). There is a storage controller that supports loading, saving and deleting entities, including default support for revisions, translations and configurable fields, in case of content entities. Additionally, there are separate controllers for access control, viewing entities, listing them and forms.

Entity types in core are either configuration or content entities. Configuration entities are stored in the configuration system and can be deployed and provided as default configuration. Content entities consist of configurable and base fields, can have revisions and support translations.

The entity system has been overhauled and extended for Drupal 8.

This is page is still a stub, documentation is being written while the Entity API is finalized for Drupal 8.

TODO/Planned:
- Controllers/Handlers
- - Storage
- - Access
- - Forms
- - View Builder
- - List
- Bundles
- Configuration entities
- Content entities
- - Revisions
- - Translations
- - Fields
- UUID support
- Entity query
- Routing

In Drupal 8 Entity API is being worked on in
* #2095603: [meta] Complete Entity Field API
* #1540656: [META] Entity Serialization API for web services (e.g. content staging)
* _#1234567: Entity Forms API

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

How about comment system? Has it been finally liberated from the content type entities? Can the comment entities now be attached to any entity types?