实体服务 API 到文档服务 API 迁移参考
🌐 Entity Service API to Document Service API migration reference
Page summary:文档服务 API 在 Strapi 5 中取代了实体服务 API。升级工具的代码修改(codemod)会自动转换函数调用和
publicationState到status,但documentId的值以及像publish()和unpublish()这样的发布方法仍需手动干预。🌐 The Document Service API replaces the Entity Service API in Strapi 5. The upgrade tool's codemod automatically converts function calls and
publicationStatetostatus, but manual intervention is required fordocumentIdvalues and publication methods likepublish()andunpublish().
在 Strapi 5 中,文档服务 API 替代了 Strapi v4 的实体服务 API(见 重大更改说明)。
🌐 In Strapi 5, the Document Service API replaces the Entity Service API from Strapi v4 (see breaking change description).
本页面旨在向开发者说明如何从实体服务 API 迁移,通过描述哪些自定义代码的更改将由 升级工具 的代码修改(codemods)处理,以及哪些将需要手动处理。
🌐 The present page is intended to give developers an idea of how to migrate away from the Entity Service API, by describing which changes in custom code will be handled by codemods from the upgrade tool and which will have to be handled manually.
使用升级工具进行迁移
🌐 Migration using the upgrade tool
在使用 升级工具 时,会运行一个代码修改工具(codemod),并处理 entityService 迁移的某些部分。
🌐 When using the upgrade tool, a codemod is run and handles some parts of the entityService migration.