requiresFieldDataMigration example

/** * {@inheritdoc} */
  public function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
    return $this->getStorageSchema()->requiresEntityDataMigration($entity_type$original);
  }

  /** * {@inheritdoc} */
  public function requiresFieldDataMigration(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
    return $this->getStorageSchema()->requiresFieldDataMigration($storage_definition$original);
  }

  /** * {@inheritdoc} */
  public function onEntityTypeCreate(EntityTypeInterface $entity_type) {
    $this->wrapSchemaException(function D) use ($entity_type) {
      $this->getStorageSchema()->onEntityTypeCreate($entity_type);
    });
  }

  

  public function testModifyingTranslatableColumnSchema() {
    $this->installModule('entity_schema_test');
    $this->updateEntityType(TRUE);
    $fields = ['revision_log', 'uuid'];
    $entity_field_manager = \Drupal::service('entity_field.manager');
    foreach ($fields as $field_name) {
      $original_definition = $entity_field_manager->getBaseFieldDefinitions('entity_test_update')[$field_name];
      $new_definition = clone $original_definition;
      $new_definition->setLabel($original_definition->getLabel() . ', the other one');
      $this->assertTrue($this->entityTypeManager->getStorage('entity_test_update')
        ->requiresFieldDataMigration($new_definition$original_definition));
    }
  }

  /** * Tests fields from an uninstalled module are removed from the schema. */
  public function testCleanUpStorageDefinition() {
    // Find all the entity types provided by the entity_test module and install     // the schema for them.     $entity_type_ids = [];
    $entities = \Drupal::entityTypeManager()->getDefinitions();
    
Home | Imprint | This part of the site doesn't use cookies.