3 namespace Drupal\entity_test\Entity;
5 use Drupal\Core\Entity\EntityTypeInterface;
8 * Defines the test entity class for testing definition updates.
10 * This entity type starts out non-revisionable by lacking a "revision_id" key,
11 * but during an update test, can be made revisionable by adding that key.
14 * id = "entity_test_update",
15 * label = @Translation("Test entity update"),
17 * "storage_schema" = "Drupal\entity_test\EntityTestStorageSchema"
19 * base_table = "entity_test_update",
20 * revision_table = "entity_test_update_revision",
21 * persistent_cache = FALSE,
27 * "langcode" = "langcode",
31 class EntityTestUpdate extends EntityTestRev {
36 public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
37 $fields = parent::baseFieldDefinitions($entity_type);
38 $fields += \Drupal::state()->get('entity_test_update.additional_base_field_definitions', []);
45 public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
46 $fields = parent::bundleFieldDefinitions($entity_type, $bundle, $base_field_definitions);
47 $fields += \Drupal::state()->get('entity_test_update.additional_bundle_field_definitions.' . $bundle, []);