Code your own entity

Fago did a presentation about how to implement your own entity. Basically you would like to create your own entity when you need objects that have a different behavior to the existing entities like nodes, user or vocabularies. One of the most prominent features of entities is, that they can be fieldable - which means you can attach fields to them.

Each entity has a base table; the table for the node entities for example is called "node". It has a couple of columns, which are referred to as properties of the entities.

The API for working with entities consists of two parts; the basic stuff has been included in core; the rest is available with the contrib module "Entity API". One neat thing provided by the Entity API are Entity Wrappers - objects which help to load and save your field values.