Entity keys

The entity API defines a set of keys that are consistent across all entity types and by which common entity information can be retrieved. Since not all entity types need to have the same fields for storing that data, there is a mapping that can be done in the annotation for these:

*   entity_keys = { 
*     "id" = "nid", 
*     "revision" = "vid", 
*     "bundle" = "type", 
*     "label" = "title", 
*     "langcode" = "langcode", 
*     "uuid" = "uuid", 
*     "status" = "status", 
*     "published" = "status", 
*     "uid" = "uid", 
*     "owner" = "uid", 
*   }, 
 

The Node entity type has a relatively comprehensive example of entity keys. As you can see, the unique identifier field for Nodes has always been nid. However, the common identifier for entities across the system is id. So, a mapping here helps facilitate that.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset