Backup of db before drupal security update
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Entity / EntityTestUpdate.php
1 <?php
2
3 namespace Drupal\entity_test\Entity;
4
5 use Drupal\Core\Entity\EntityTypeInterface;
6
7 /**
8  * Defines the test entity class for testing definition updates.
9  *
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.
12  *
13  * @ContentEntityType(
14  *   id = "entity_test_update",
15  *   label = @Translation("Test entity update"),
16  *   handlers = {
17  *     "storage_schema" = "Drupal\entity_test\EntityTestStorageSchema"
18  *   },
19  *   base_table = "entity_test_update",
20  *   revision_table = "entity_test_update_revision",
21  *   persistent_cache = FALSE,
22  *   entity_keys = {
23  *     "id" = "id",
24  *     "uuid" = "uuid",
25  *     "bundle" = "type",
26  *     "label" = "name",
27  *     "langcode" = "langcode",
28  *   }
29  * )
30  */
31 class EntityTestUpdate extends EntityTestRev {
32
33   /**
34    * {@inheritdoc}
35    */
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', []);
39     return $fields;
40   }
41
42   /**
43    * {@inheritdoc}
44    */
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, []);
48     return $fields;
49   }
50
51 }