Fix DocumentDataManagerController not found for legacy class_key - #6
Open
Ibochkarev wants to merge 1 commit into
Open
Fix DocumentDataManagerController not found for legacy class_key#6Ibochkarev wants to merge 1 commit into
Ibochkarev wants to merge 1 commit into
Conversation
Treat short modDocument/modResource as core documents in getInstance, add the DocumentData alias (parity with create/update), and load overview via modResource so STI still resolves short keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что сделано
Resource Overview (
resource/data) выбрасывалClass 'DocumentDataManagerController' not found, когда ресурс хранил устаревший короткийclass_keymodDocument(часто для API/extra-create) или когдаclass_keyприсутствовал в запросе.ResourceManagerController::getInstance()трактовал такие ключи как производные и переписывал имя контроллера черезgetAlias(), но в отличие от create/update (modxcms#15997) у data-контроллера не было алиасаDocumentDataManagerController. Короткие ключи также ломали STI-lookup, когда обзор грузился черезmodDocument::class.Это изменение:
getInstance().DocumentDataManagerController(паритет с create/update).modResource::class, чтобы короткие ключи продолжали резолвиться.modResource/ короткихmodResourceключей (не переписывает короткийmodDocumentна GET).Как проверить
class_key=modDocument(короткий), откройте Manager → Overview для него. Ожидание: без ошибки class-not-found.?a=resource/data&id=1&class_key=MODX\Revolution\modDocument(и с короткимmodDocument). Ожидание: data-контроллер грузится.WebLinkDataManagerControllerпо-прежнему.php -l manager/controllers/default/resource/resource.class.php→ exit 0php -l manager/controllers/default/resource/data.class.php→ exit 0core/vendor/bin/phpunit -c _build/test/phpunit.xml --filter ResourceManagerControllerGetInstanceTest --no-coverage→ OK (9 тестов, 27 assertions)core/vendor/bin/phpcs --standard=phpcs.xml _build/test/Tests/Controllers/Resources/ResourceManagerControllerGetInstanceTest.php→ exit 0Связанные
Refs modxcms#15080
Связанные: modxcms#16004 / modxcms#15997 (алиасы DocumentCreate/DocumentUpdate). Контекст короткого
class_keyCollections: modxcms/Collections#353.Совместимость
Универсально. Помогает установкам/экстра, которые всё ещё хранят короткий
modDocument. Не мигрирует существующие строки короткогоmodDocumentна overview GET.Оригинал: modxcms#17008