deleteLastInstalledFieldStorageDefinition example

    if ($storage_definition instanceof BaseFieldDefinition && $storage instanceof FieldableEntityStorageInterface && $storage->countFieldData($storage_definition, TRUE)) {
      $deleted_storage_definition = clone $storage_definition;
      $deleted_storage_definition->setDeleted(TRUE);
      $this->deletedFieldsRepository->addFieldDefinition($deleted_storage_definition);
      $this->deletedFieldsRepository->addFieldStorageDefinition($deleted_storage_definition);
    }

    if ($storage instanceof FieldStorageDefinitionListenerInterface) {
      $storage->onFieldStorageDefinitionDelete($storage_definition);
    }

    $this->entityLastInstalledSchemaRepository->deleteLastInstalledFieldStorageDefinition($storage_definition);

    $this->eventDispatcher->dispatch(new FieldStorageDefinitionEvent($storage_definition), FieldStorageDefinitionEvents::DELETE);
    $this->entityFieldManager->clearCachedFieldDefinitions();
  }

}
Home | Imprint | This part of the site doesn't use cookies.