LogoLogo
9.0.x
9.0.x
  • Overview
    • About Varbase
    • Roadmap
    • Release Cycle and Supported Versions
    • How to Get Support
  • Developers
    • Getting Started
    • Installing Varbase
      • Requirements
      • Installing Varbase with DDEV
      • Installing Varbase with Lando
    • Understanding Varbase
      • Basic Concepts
      • Core Components
        • Varbase Core
          • Varbase Admin
          • Varbase Page
          • Varbase Security
          • Varbase Webform
          • Varbase Default Content
          • Varbase Tour
        • Varbase Media
        • Varbase Editor
        • Varbase Email
        • Varbase SEO
        • Varbase Workflow
        • Varbase Layout Builder
          • Varbase Landing page (Layout Builder)
          • Varbase Heading Block
          • Varbase Rich Text Block
          • Varbase HTML Code Block
          • Varbase Media (Image/Video) Block
          • Varbase Gallery Block
        • Varbase Total Control Dashboard
        • Vartheme Claro
        • Vartheme BS4
      • Optional Components
        • Varbase API
        • Varbase Internationalization
        • Varbase Media Hero Slider
        • Varbase Carousels
        • Varbase Blog
        • Varbase Search
        • Varbase Social Single Sign-On
        • Varbase Media Twitter
        • Varbase Media Instagram
        • Varbase Content Planner
        • Varbase Bootstrap Paragraphs
          • Varbase Bootstrap Paragraphs Text and Image
        • Varbase Landing Page (Paragraphs)
      • Additional Components
        • Varbase Media Header
        • Varbase FAQs
        • Varbase Reports
        • Varbase Commerce
        • Varbase YouTube Import
      • Development Components
        • Varbase Development
        • Varbase Style Guide
        • Reroute Email
        • Varbase Updates Helper
    • Configuring a Varbase Site
      • Navigation
        • Defining Active Menu Trail Using Menu Position
      • Using View Modes Inventory
      • Content Moderation and Workflows
      • URL Aliases in Varbase/Drupal
        • Configuring URL Aliases
        • Managing URL Aliases
      • Managing URL Patterns for Multilingual Websites
      • Managing Date and Time Formats to Display Across the Site
      • Using Varbase Layout Builder
        • Creating a Landing Page With Varbase Layout Builder
        • Activating Varbase Layout Builder for Content Types
      • Configuring Pathologic When Going Live
      • Configuring SEO Features
        • Disallow Oembed Media Links
      • Configuring Security Features
        • Spam Protection
        • Password Policies
        • Other Security Kits
        • Flood Contorl
        • Enable HTTP Password Authentication
      • Configuring JSON:API Features
      • Configure Varbase Media Hero Slider
      • Configuring Varbase Media Header
      • Configuring Varbase Mailer Settings
        • Configure Symfony Mailer
        • Configure Swift Mailer
        • Switch From Swift Mailer to Symfony Mailer
      • Entity Definition Update Manager Class
      • Module Installer Factory Class
    • Theme Development with Varbase
      • Understanding The Vartheme Base Theme
      • Creating Your Own Theme
      • Local Tasks and Moderation Sidebar
      • Add Preloaded Fonts in Vartheme
      • Switch From Node SASS to Dart SASS for Old Sub-Themes
    • Launching a Varbase Site to Production
    • Updating a Varbase Site
      • Understanding Varbase Updater Package
      • Handling Patches When Updating
      • Handling Configuration Updates
      • Updating Varbase to work with Composer 2.0
      • Updating Drush to the Latest Stable Version
      • Version Update Guides
        • Updating Varbase ~9.0 to Drupal 10
        • Switch from CKEditor 4 to CKEditor 5 in Varbase ~9.1.0
        • Updating from Varbase 8.x to 9.x
    • Varbase Patches
    • Frequently Asked Questions (FAQs)
    • Extending Varbase
      • Overriding Varbase
      • Creating Your Own Feature
      • Creating A Sub Profile From Varbase
        • Varbase Sub Profile Generator
        • Varbase Sub Profile Basic Template
        • Varbase Sub Profile Basic Project Template
      • Install Needed YARN and Gulp Tools
      • Compiling Provided Component Styles
      • Check Standards/Practice Coding And Linting
  • Content Designers
    • Terminology
    • Accessing the Administration Area
      • Website Environments
    • User Management
      • Allow Email/Username Login & Registration
      • Default Roles and Site Personas
        • Edit Roles' Permissions
        • Managing Roles
      • Add User
      • Edit User
      • Masquerading as another user
    • Dashboard
      • Reports
    • Content Structure
      • EntityQueues
      • Menu Management
        • Add Menu Items
        • Update Menu Items
        • Adding a Page to the Menu
      • Taxonomies
        • Manage Vocabulary
        • Edit Vocabulary
        • List Terms
        • Add Terms
        • Reorder and Edit Terms
      • Webforms
        • Setting up Emails Handler Conditions
        • Setting up Confirmations Message Settings Types
    • Content Management
      • Create Content
        • Add a Basic page
        • Add a Landing page
        • Add Blog
        • Add Media
          • Image
          • Remote video
          • Video
      • Modify Content
      • Delete Content
      • Preview Content
      • Bulk Edit Content
      • Content Moderation
      • Publish Content
      • URL Alias
    • About Layout Builder
      • Section
      • Custom Blocks
        • Heading Block
        • Basic Block
        • Media Block(Image/Video)
        • Rich-Text Editor “WYSIWYG”
      • Managing Blocks
    • Search Engine Optimization
      • XML Sitemap
      • Meta Tags in Varbase
      • URL Redirects
      • Domain Redirects
      • Prevent a Single Content From Being Indexed
    • Site Configuration
      • System
        • Clearing Varbase Cache
        • Google analytics
        • Mail templates
      • User interface
      • Development
      • Varbase settings
      • Web services
    • Common Error Handling Tips
  • Contributing
    • Contributing to Documentation
Powered by GitBook
On this page
  • How to Use Entity Definition Update Manager Class
  • 1. Require the Package in Your Module or Project
  • 2. Add The Needed Namespaces
  • 3. Do Any Type of Configuration Import or Updates
  • 4. Run the Drupal Class Resolver for the Instance From the Definition Class
  • Example Use On Installations
  • Example Use On Updates
  • Example Use On Custom Template Config Imports
  • When to Use and When Not to Use?
  1. Developers
  2. Configuring a Varbase Site

Entity Definition Update Manager Class

PreviousSwitch From Swift Mailer to Symfony MailerNextModule Installer Factory Class

Last updated 1 year ago

Provides developers with a class to perform automatic entity updates.

Use only in the development environment. Not to use on production websites.

Support for automatic entity updates has been removed

User deprecated function: EntityDefinitionUpdateManagerInterface::applyUpdates() was deprecated in Drupal 8.7.0 and was removed before Drupal 9.0.0.

How to Use Entity Definition Update Manager Class

Customized class for the entity definition update manager.

1. Require the Package in Your Module or Project

$ composer require vardot/entity-definition-update-manager:~1.0

Or add the package to your composer.json file

    "vardot/entity-definition-update-manager": "~1.0",

2. Add The Needed Namespaces

Add the following namespace in custom modules or custom installation profiles.

use Vardot\Entity\EntityDefinitionUpdateManager;

3. Do Any Type of Configuration Import or Updates

Import or update configs in hook install or hook update, or any post install or post update.

4. Run the Drupal Class Resolver for the Instance From the Definition Class

  // Entity updates to clear up any mismatched entity and/or field definitions
  // And Fix changes were detected in the entity type and field definitions.
  \Drupal::classResolver()
    ->getInstanceFromDefinition(EntityDefinitionUpdateManager::class)
    ->applyUpdates();

Example Use On Installations

Varbase Core is important number of managed configurations on install. It needed to update entity definitions after that.

Have a look at the varbase_core_install hook function

Example Use On Updates

Varbase API in some point needed to update configurations in a hook update. It needed to update entity definitions after that. Which did not work without entity definition update.

Have a look at the varbase_api_update_8702 hook function

Example Use On Custom Template Config Imports

  • Having custom and managed config templates. Which on import to the active config for selected entity types or fields.

  • Entity definitions need to be auto updated

  • Field definitions need to be auto updated.

Have a look at the following commit to use in Custom Config Import Classes

When to Use and When Not to Use?

Do not use when the import/update of configs works in the normal way.

If all configs are in the config/install and no issues on install.

Use when custom managed configs just have been imported or updated in a custom order, And custom actions or changes in between imports are being involved.

If the module or profile has number of optional or managed configs. Which located in config/optional or config/managed or any other custom physical locations.

When importing or updating with custom Drupal Config Factory or Drupal Install Factory.

Must run at least ones at the end of each installation steps for installation profiles like , , .

https://git.drupalcode.org/project/varbase_core/-/blob/9.0.x/varbase_core.install#L77
https://git.drupalcode.org/project/varbase_api/-/blob/9.0.x/varbase_api.install#L159
https://git.drupalcode.org/project/varbase_media_header/-/commit/8ae8d4c
Varbase
Vardoc
Uber Publisher
https://www.drupal.org/node/3034742
GitHub - Vardot/entity-definition-update-manager: Entity Definition Update ManagerGitHub
Logo