You are here

public function EntityTest::getEntityKey in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php \Drupal\entity_test\Entity\EntityTest::getEntityKey()
  2. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php \Drupal\entity_test\Entity\EntityTest::getEntityKey()

Gets the value of the given entity key, if defined.

Parameters

string $key: Name of the entity key, for example id, revision or bundle.

Return value

mixed The value of the entity key, NULL if not defined.

Overrides ContentEntityBase::getEntityKey

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php, line 169

Class

EntityTest
Defines the test entity class.

Namespace

Drupal\entity_test\Entity

Code

public function getEntityKey($key) {

  // Typically this protected method is used internally by entity classes and
  // exposed publicly through more specific getter methods. So that test cases
  // are able to set and access entity keys dynamically, update the visibility
  // of this method to public.
  return parent::getEntityKey($key);
}