function ContentEntityType::hasIntegerId

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType::hasIntegerId()

Overrides EntityType::hasIntegerId

File

core/lib/Drupal/Core/Entity/ContentEntityType.php, line 96

Class

ContentEntityType
Provides an implementation of a content entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function hasIntegerId() : ?bool {
  if ($this->hasKey('id') && $this->entityClassImplements(FieldableEntityInterface::class)) {
    $definitions = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($this->id());
    return $definitions[$this->getKey('id')]
      ->getType() === 'integer';
  }
  return NULL;
}

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