function DefaultTableMappingIntegrationTest::entityBaseFieldInfo

Implements hook_entity_base_field_info().

Attributes

#[Hook('entity_base_field_info')]

File

core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php, line 158

Class

DefaultTableMappingIntegrationTest
Tests the default table mapping class for content entities stored in SQL.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function entityBaseFieldInfo(EntityTypeInterface $entity_type) : array {
  $definitions = [];
  if ($entity_type->id() === 'entity_test_mulrev') {
    $definitions['multivalued_base_field'] = BaseFieldDefinition::create('string')->setName('multivalued_base_field')
      ->setTargetEntityTypeId('entity_test_mulrev')
      ->setTargetBundle('entity_test_mulrev')
      ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
      ->setTranslatable(FALSE)
      ->setRevisionable(FALSE);
  }
  return $definitions;
}

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