diff -u b/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php --- b/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -205,23 +205,23 @@ * An array of values from the annotation. */ public function __construct($definition) { - foreach ($definition as $key => $value) { - $this->{$key} = $value; + foreach ($definition as $property => $value) { + $this->{$property} = $value; } } /** * {@inheritdoc} */ - public function get($key) { - return isset($this->{$key}) ? $this->{$key} : NULL; + public function get($property) { + return isset($this->{$property}) ? $this->{$property} : NULL; } /** * {@inheritdoc} */ - public function set($key, $value) { - $this->{$key} = $value; + public function set($property, $value) { + $this->{$property} = $value; return $this; } diff -u b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php --- b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -13,38 +13,27 @@ interface EntityTypeInterface { /** - * Gets any arbitrary key. + * Gets any arbitrary property. * - * @param string $key - * The key to retrieve. + * @param string $property + * The property to retrieve. * * @return mixed - * The value for that key, or NULL if the key did not exist. + * The value for that property, or NULL if the property does not exist. */ - public function get($key); + public function get($property); /** - * Sets a value to an arbitrary key. + * Sets a value to an arbitrary property. * - * @param string $key - * The key to use for the value. + * @param string $property + * The property to use for the value. * @param mixed $value * The value to set. * * @return static */ - public function set($key, $value); - - /** - * Indicates if a given entity key exists. - * - * @param string $key - * The name of the entity key to check. - * - * @return bool - * TRUE if a given entity key exists, FALSE otherwise. - */ - public function hasKey($key); + public function set($property, $value); /** * Returns the unique identifier of the entity type. @@ -71,6 +60,36 @@ public function getClass(); /** + * Returns an array of entity keys. + * + * @return 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. This entry can be omitted if + * the entities of this type are not versionable. + * - 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: 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, a 'label_callback' should be defined instead (see the + * $label_callback block above for details). + * - 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. + */ + public function getKeys(); + + /** * Returns a specific entity key. * * @param string $key @@ -84,6 +103,17 @@ public function getKey($key); /** + * Indicates if a given entity key exists. + * + * @param string $key + * The name of the entity key to check. + * + * @return bool + * TRUE if a given entity key exists, FALSE otherwise. + */ + public function hasKey($key); + + /** * Indicates whether entities should be statically cached. * * @return bool @@ -111,36 +141,6 @@ public function isFieldDataCacheable(); /** - * Returns an array of entity keys. - * - * @return 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. This entry can be omitted if - * the entities of this type are not versionable. - * - 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: 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, a 'label_callback' should be defined instead (see the - * $label_callback block above for details). - * - 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. - */ - public function getKeys(); - - /** * Sets the name of the entity type class. * * @param string $class