8.3.x EntityTypeInterface.php public EntityTypeInterface::getKeys()
8.0.x EntityTypeInterface.php public EntityTypeInterface::getKeys()
8.1.x EntityTypeInterface.php public EntityTypeInterface::getKeys()
8.2.x EntityTypeInterface.php public EntityTypeInterface::getKeys()
8.4.x EntityTypeInterface.php public EntityTypeInterface::getKeys()

Gets an array of entity keys.

Return value

array An array describing how the Field API can extract certain information from objects of this entity type:

  • id: The name of the property that contains the primary ID of the entity. Every entity object passed to the Field API must have this property and its value must be numeric.
  • revision: (optional) The name of the property that contains the revision ID of the entity. The Field API assumes that all revision IDs are unique across all entities of a type. If this entry is omitted the entities of this type are not revisionable.
  • bundle: (optional) The name of the property that contains the bundle name for the entity. The bundle name defines which set of fields are attached to the entity (e.g. what nodes call "content type"). This entry can be omitted if this entity type exposes a single bundle (such that all entities have the same collection of fields). The name of this single bundle will be the same as the entity type.
  • label: (optional) The name of the property that contains the entity label. For example, if the entity's label is located in $entity->subject, then 'subject' should be specified here. If complex logic is required to build the label, \Drupal\Core\Entity\EntityInterface::label() should be used.
  • langcode: (optional) The name of the property that contains the language code. For instance, if the entity's language is located in $entity->langcode, then 'langcode' should be specified here.
  • uuid: (optional) The name of the property that contains the universally unique identifier of the entity, which is used to distinctly identify an entity across different systems.
1 method overrides EntityTypeInterface::getKeys()
EntityType::getKeys in core/lib/Drupal/Core/Entity/EntityType.php
Gets an array of entity keys.

File

core/lib/Drupal/Core/Entity/EntityTypeInterface.php, line 109

Class

EntityTypeInterface
Provides an interface for an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function getKeys();