What is an Entity?
- A Drupal object that represent an object within the problem/business domain
- Consists of : database tables, php code
Where do Entities come from?
- You discover, define, and refine the objects within the business/problem domain by working with the client (iterative process; use diagramming methodologies (ORM), sometimes driven by legacy data (already existing)
- You use specific Drupal Hooks to define the database tables and to make them visible Views
- You use the Entity API contributed module to obtain out-of the box CRUD
Why use them?
- Entities provide a clean an d functional way to map real-world objects within the business/problem domain to objects that can be manipulated by code and persisited in a database
- You do not have to forcea a mapping form the real-world to built-in Contey Types, whci Druapl provides, when that mapping is inapporpriated
- Foreaample, a Donation does not map cleanly to any of the Durpal built-in Entities, (such as node, user, taxonomy)
- Use of Entities facilitates writing correct, maintainable code
When to use them?
- When you need to rpovide a clean an dunctional way to map real-world objects within the business/problem domain to bo
- When you need to use legacy data
How to use Them? Take these Steps
- Discover, define, and refine
- Determine if you want to be able to add fields later on via the CCK mdule
- Create a Drupal Module that implements these HOOKS
- HOOK_schema to create the physical database tables
- HOOK_entity_property_info to integrate views