function DefaultHtmlRouteProvider::getEntityTypeIdKeyType

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getEntityTypeIdKeyType()
  2. 9 core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getEntityTypeIdKeyType()
  3. 8.9.x core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getEntityTypeIdKeyType()
  4. main core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getEntityTypeIdKeyType()

Gets the type of the ID key for a given entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type.

Return value

string|null The type of the ID key for a given entity type, or NULL if the entity type does not support fields.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. To determine if an entity type has an integer ID key, use \Drupal\Core\Entity\EntityTypeInterface::hasIntegerId().

See also

https://www.drupal.org/node/3566814

1 call to DefaultHtmlRouteProvider::getEntityTypeIdKeyType()
TestDefaultHtmlRouteProvider::getEntityTypeIdKeyType in core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php
Gets the type of the ID key for a given entity type.
1 method overrides DefaultHtmlRouteProvider::getEntityTypeIdKeyType()
TestDefaultHtmlRouteProvider::getEntityTypeIdKeyType in core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php
Gets the type of the ID key for a given entity type.

File

core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php, line 356

Class

DefaultHtmlRouteProvider
Provides HTML routes for entities.

Namespace

Drupal\Core\Entity\Routing

Code

protected function getEntityTypeIdKeyType(EntityTypeInterface $entity_type) {
  @trigger_error(__METHOD__ . "() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To determine if an entity type has an integer ID key, use \\Drupal\\Core\\Entity\\EntityTypeInterface::hasIntegerId(). See https://www.drupal.org/node/3566814", E_USER_DEPRECATED);
  if (!$entity_type->entityClassImplements(FieldableEntityInterface::class)) {
    return NULL;
  }
  $field_storage_definitions = $this->entityFieldManager
    ->getFieldStorageDefinitions($entity_type->id());
  return $field_storage_definitions[$entity_type->getKey('id')]
    ->getType();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.