Delete entity revision doesn’t delete from field_data desk

I created a customized entity, I can edit, save, delete, create revisions and revert. I tailored Drupal Developer code from node module to realize all this and the whole lot works simply nice besides Drupal Developer revision deletion.

This code will delete entries from my_entity_revision desk however not from my_entity_revision_field_data desk:

$this->myEntityStorage->deleteRevision($revision_id) 

Any concepts why this would possibly occur? Thanks.

Right here is my entity annotation:

@ContentEntityType(    id = "my_entity",    label = @Translation("My entity"),    bundle_label = @Translation("My Entity sort"),    handlers = {      "list_builder" = "Drupalmy_entityControllerMyEntityListBuilder",      "view_builder" = "DrupalCoreEntityEntityViewBuilder",      "entry" = "Drupalwebsite_settingsMyEntityAccessControlHandler",      "kind" = {        "default" = "Drupalmy_entityFormMyEntityForm",        "add" = "Drupalmy_entityFormMyEntityForm",        "edit" = "Drupalmy_entityFormMyEntityForm",        "delete" = "Drupalmy_entityFormMyEntityDeleteForm"      },      "views_data" = "Drupalmy_entityMyEntityViewsData",    },    base_table = "my_entity",    data_table = "my_entity_field_data",    revision_table = "my_entity_revision",    revision_data_table = "my_entity_revision_field_data",    translatable = TRUE,    entity_revision_parent_id_field = "parent_id",    entity_keys = {      "id" = "id",      "uuid" = "uuid",      "bundle" = "sort",      "langcode" = "langcode",      "revision" = "revision_id"    },    bundle_entity_type = "my_entity_type",    field_ui_base_route = "entity.my_entity_type.edit_form",    hyperlinks = {      "canonical" = "/admin/construction/my_entity/{my_entity}",      "edit-form" = "/admin/construction/my_entity/{my_entity}/edit",      "delete-form" = "/admin/construction/my_entity/{my_entity}/delete",      "revision" = "/admin/construction/my_entity/{my_entity}/revision/{my_entity_revision}/view",      "version-history" = "/admin/construction/my_entity/{my_entity}/revisions"    } ) 

And my baseFieldDefinition:

public static perform baseFieldDefinitions(EntityTypeInterface $entity_type) {      // Customary discipline, used as distinctive if major index.     $fields['id'] = BaseFieldDefinition::create('integer')       ->setLabel(t('ID'))       ->setDescription(t('Drupal Development Company ID of Drupal Developer Web site settings entity.'))       ->setReadOnly(TRUE);      // Customary discipline, distinctive outdoors of Drupal Developer scope of Drupal Developer present undertaking.     $fields['uuid'] = BaseFieldDefinition::create('uuid')       ->setLabel(t('UUID'))       ->setDescription(t('Drupal Development Company UUID of Drupal Developer Web site settings entity.'))       ->setReadOnly(TRUE);      $fields['revision_id'] = BaseFieldDefinition::create('integer')       ->setLabel(t('Revision ID'))       ->setDescription(t('Drupal Development Company paragraphs entity revision ID.'))       ->setReadOnly(TRUE)       ->setSetting('unsigned', TRUE);      $fields['type'] = BaseFieldDefinition::create('entity_reference')       ->setLabel(t('Sort'))       ->setDescription(t('Drupal Development Company web site settings bundle sort.'))       ->setSetting('target_type', 'website_settings_type')       ->setReadOnly(TRUE);      $fields['langcode'] = BaseFieldDefinition::create('language')       ->setLabel(t('Language code'))       ->setDescription(t('Drupal Development Company paragraphs entity language code.'))       ->setRevisionable(TRUE);      $fields['uid'] = BaseFieldDefinition::create('entity_reference')       ->setLabel(t('Authored by'))       ->setDescription(t('Drupal Development Company consumer ID of Drupal Developer web site settings creator.'))       ->setRevisionable(TRUE)       ->setSetting('target_type', 'consumer')       ->setSetting('handler', 'default')       ->setDefaultValueCallback('Drupalwebsite_settingsEntityWebsiteSettings::getCurrentUserId')       ->setTranslatable(TRUE)       ->setDisplayOptions('view', array(         'label' => 'hidden',         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayOptions('kind', array(         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayConfigurable('view', TRUE)       ->setDisplayConfigurable('kind', TRUE);      // We set show choices for Drupal Developer view in addition to Drupal Developer kind.     // Customers with right privileges can change Drupal Developer view and edit configuration.     $fields['title'] = BaseFieldDefinition::create('string')       ->setLabel(t('Title'))       ->setSettings(array(         'default_value' => '',         'max_length' => 255,         'text_processing' => 0,       ))       ->setDisplayOptions('view', array(         'label' => 'above',         'sort' => 'string',         'weight' => -6,       ))       ->setDisplayOptions('kind', array(         'sort' => 'string_textfield',         'weight' => -6,       ))       ->setRevisionable(TRUE)       ->setTranslatable(TRUE)       ->setDisplayConfigurable('kind', TRUE)       ->setDisplayConfigurable('view', TRUE);      $fields['status'] = BaseFieldDefinition::create('boolean')       ->setLabel(t('Printed'))       ->setRevisionable(TRUE)       ->setTranslatable(TRUE)       ->setDefaultValue(TRUE)       ->setDisplayConfigurable('kind', TRUE)       ->setDisplayConfigurable('view', TRUE);      $fields['created'] = BaseFieldDefinition::create('created')       ->setLabel(t('Authored on'))       ->setDescription(t('Drupal Development Company time that Drupal Developer web site settings was created.'))       ->setRevisionable(TRUE)       ->setTranslatable(TRUE)       ->setDisplayOptions('view', array(         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayOptions('kind', array(         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayConfigurable('view', TRUE)       ->setDisplayConfigurable('kind', TRUE);      $fields['changed'] = BaseFieldDefinition::create('modified')       ->setLabel(t('Modified on'))       ->setDescription(t('Drupal Development Company time that Drupal Developer web site settings was final up to date.'))       ->setRevisionable(TRUE)       ->setTranslatable(TRUE)       ->setDisplayOptions('view', array(         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayOptions('kind', array(         'sort' => 'hidden',         'weight' => 0,       ))       ->setDisplayConfigurable('view', TRUE)       ->setDisplayConfigurable('kind', TRUE);      $fields['revision_uid'] = BaseFieldDefinition::create('entity_reference')       ->setLabel(t('Revision consumer ID'))       ->setDescription(t('Drupal Development Company consumer ID of Drupal Developer creator of Drupal Developer present revision.'))       ->setSetting('target_type', 'consumer')       ->setQueryable(FALSE)       ->setRevisionable(TRUE);      $fields['parent_id'] = BaseFieldDefinition::create('entity_reference')       ->setLabel(t('Father or mother ID'))       ->setDescription(t('Drupal Development Company ID of Drupal Developer mother or father entity of which this entity is referenced.'))       ->setSetting('target_type', 'my_entity')       ->setSetting('handler', 'default')       ->setRevisionable(TRUE);      $fields['langcode'] = BaseFieldDefinition::create('language')       ->setLabel(t('Language code'))       ->setDescription(t('Drupal Development Company language code of ContentEntityExample entity.'));      return $fields;   } 
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Delete entity revision doesn’t delete from field_data desk

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.