vardot/entity-definition-update-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vardot/entity-definition-update-manager

Composer 安装命令:

composer require vardot/entity-definition-update-manager

包简介

Entity Definition Update Manager - Provides developers with a class to perform automatic entity updates.

README 文档

README

Provides developers with a class to perform automatic entity updates.

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

Support for automatic entity updates has been removed

https://www.drupal.org/node/3034742

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.

Require the Package in your root composer.json file

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

Or require the Package in your Project with a command

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

1. Add Needed Namespace

Add the following name space at in custom modules or custom installation profiles.

use Vardot\Entity\EntityDefinitionUpdateManager;

2. 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.

3. Run the 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 Installs

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

https://git.drupalcode.org/project/varbase_core/-/blob/9.0.x/varbase_core.install#L77

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

https://git.drupalcode.org/project/varbase_api/-/blob/9.0.x/varbase_api.install#L159

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 are 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 physical locations. Then they are imported or updated 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 Varbase, Vardoc, Uber Publisher.

vardot/entity-definition-update-manager 适用场景与选型建议

vardot/entity-definition-update-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 160.18k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vardot/entity-definition-update-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vardot/entity-definition-update-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 vardot/entity-definition-update-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 160.18k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2021-09-12