ECK for Developers

The Entity API already does a great job allowing us to deal with entities from code with ease. Dealing with Entity types and bundles is not the same. Here is where ECK comes in to fill the gap. Also ECK introduces a new idea: property behaviors. Property behaviors allows us to develop functionality for an entity's property in a centralized and reusable way.

ECK fully supports Features, so even though entity types, properties, and bundles can all easily be created from code, they could as easily (if not easier) also be created from the UI and be exported to code by using the Features module.

Adding properties to an entity type

We can easily add new properties to an entity type by using the addProperty method.

Creating entities programmatically

Using the Entity API module makes this fairly straightforward. Let's say there's an entity type called "Contact" [contact] and a bundle

Creating, Loading, and Deleting Entity Types

To create a new Entity Type simply create an object of the Entity Type class.

Property behaviors

Sometime in ECK 1.x, the ability to add/delete properties from an entity type was introduced. The slight problem was that there was no "good

Guide maintainers

fmizzell's picture