Fix DocumentDataManagerController not found for legacy class_key - #17008
Open
Ibochkarev wants to merge 1 commit into
Open
Fix DocumentDataManagerController not found for legacy class_key#17008Ibochkarev 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.
What changed and why
Resource Overview (
resource/data) threwClass 'DocumentDataManagerController' not foundwhen a resource stored the legacy shortclass_keymodDocument(common for API/extra creates) or whenclass_keywas present in the request.ResourceManagerController::getInstance()treated those keys as derivatives and rewrote the controller name viagetAlias(), but unlike create/update (#15997) the data controller had noDocumentDataManagerControlleralias. Short keys also failed STI lookup when overview loaded viamodDocument::class.This change:
getInstance()DocumentDataManagerControlleralias (parity with create/update)modResource::classso short keys still resolvemodResource/modResourceshort keys only (does not rewrite shortmodDocumenton GET)How to test
class_key=modDocument(short), open Manager → Overview for that resource. Expect no class-not-found error.?a=resource/data&id=1&class_key=MODX\Revolution\modDocument(and with shortmodDocument). Expect the overview controller to load.WebLinkDataManagerControllerstill.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 tests, 27 assertions)core/vendor/bin/phpcs --standard=phpcs.xml _build/test/Tests/Controllers/Resources/ResourceManagerControllerGetInstanceTest.php→ exit 0Related issue(s)/PR(s)
Resolves #15080
Related: #16004 / #15997 (DocumentCreate/DocumentUpdate aliases). Collections short
class_keycontext: modxcms/Collections#353.Compatibility notes
Universal. Helps installs/extras that still persist short
modDocument. Does not migrate existing shortmodDocumentrows on overview GET.Breaking change assessment
No public API signature changes. Create with a core-document
class_keyrequest param now skips the derivative controller rename path and instantiatesResourceCreateManagerControllerdirectly (equivalent to the previous alias path).Test coverage
Added
_build/test/Tests/Controllers/Resources/ResourceManagerControllerGetInstanceTest.phpfor short/FQCN document keys, Weblink derivative regression, and the DocumentData alias.Contributors
Thanks @Ruslan-Aleev for the original report and @Lystapad for identifying the short
class_keypath.AI tool use
Cursor agent assisted with investigation, implementation, tests, and PR drafting under human direction.