W3cubDocs

/Drupal 8

public function EntityType::getKeys

public EntityType::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.

Overrides EntityTypeInterface::getKeys

File

core/lib/Drupal/Core/Entity/EntityType.php, line 364

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function getKeys() {
  return $this->entity_keys;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityType.php/function/EntityType::getKeys/8.1.x