class EntitySerializedField

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php \Drupal\entity_test\Entity\EntitySerializedField

Defines a test class for testing fields with a serialized column.

Plugin annotation


@ContentEntityType(
  id = "entity_test_serialized_field",
  label = @Translation("Test serialized fields"),
  entity_keys = {
    "id" = "id",
    "uuid" = "uuid",
    "bundle" = "type",
    "label" = "name"
  },
  base_table = "entity_test_serialized_fields",
  persistent_cache = FALSE,
  serialized_field_property_names = {
    "serialized_long" = {
      "value"
    }
  }
)

Hierarchy

Expanded class hierarchy of EntitySerializedField

2 files declare their use of EntitySerializedField
DenormalizeTest.php in core/modules/hal/tests/src/Kernel/DenormalizeTest.php
EntitySerializationTest.php in core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php

File

core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php, line 29

Namespace

Drupal\entity_test\Entity
View source
class EntitySerializedField extends EntityTest {
  
  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['serialized'] = BaseFieldDefinition::create('serialized_item_test')->setLabel(t('Serialized'));
    $fields['serialized_text'] = BaseFieldDefinition::create('serialized_property_item_test')->setLabel(t('Serialized text'));
    $fields['serialized_long'] = BaseFieldDefinition::create('string_long')->setLabel(t('Serialized long string'));
    return $fields;
  }

}

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