fix(schema): use FQCN for core model classes to resolve PSR-4 deprecation#16919
Open
Ibochkarev wants to merge 4 commits intomodxcms:3.xfrom
Open
fix(schema): use FQCN for core model classes to resolve PSR-4 deprecation#16919Ibochkarev wants to merge 4 commits intomodxcms:3.xfrom
Ibochkarev wants to merge 4 commits intomodxcms:3.xfrom
Conversation
Replace class="modNamespace" with class="MODX\Revolution\modNamespace" in modx.mysql.schema.xml so the profiler and loadClass no longer trigger the v3.0 deprecation warning for short class name.
Replace short class names with MODX\Revolution\ FQCN in modx.mysql.schema.xml to resolve PSR-4 deprecation warnings in profiler (v3.0).
Replace short class names with MODX\Revolution\* for modAccess, modMenu, modResource, modUser, modTemplate, modChunk, modSnippet, modCategory, modContext, modEvent, modFormCustomization*, modTemplateVar*, modUserGroup*, and all other core model classes in modx.mysql.schema.xml to resolve PSR-4 deprecation warnings (v3.0).
…ility Add isShortModClassName() helper and runtime normalization in loadClass(). Short names (modResource, modAccessContext, etc.) are converted to MODX\Revolution\* FQCN to avoid deprecation from xPDO call paths. Creates class_alias for backward compatibility.
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 does it do?
Use fully qualified class names (FQCN) for all core model classes in
core/model/schema/modx.mysql.schema.xml. Replaces every short class name (e.g.class="modNamespace",class="modResource",class="modUser") withMODX\\Revolution\\*equivalents. Covers modNamespace, modPlugin, modPluginEvent, modSystemSetting, modMenu, modResource, modUser, modTemplate, modChunk, modSnippet, modCategory, modContext, modEvent, modFormCustomization*, modTemplateVar*, modUserGroup*, modAccess*, and all othermod*objects in the main schema.Additionally,
modX::loadClass()now normalizes shortmod*names to FQCN at runtime. When legacy code or xPDO call paths pass short names (e.g.modResource,modAccessContext), they are converted toMODX\Revolution\*internally. Aclass_aliasis created for backward compatibility. This avoids deprecation notices fromgetObject,getCollection,newQuery, and other paths that invokeloadClassbeforemodAccessibleObject::load.Why is it needed?
Short names in the schema cause the profiler and
modX::loadClass()to trigger v3.0 deprecation warnings that tell users to replace references withMODX\\Revolution\\*for PSR-4 autoloading. Application code already usesmodNamespace::classand equivalent; the warnings come from the schema-defined class attribute and the resulting xPDO map keys. Updating the schema to FQCN aligns metadata with PSR-4 and removes the deprecation notices. Runtime normalization inloadClass()handles remaining call paths that still pass short names.How to test
Run the application with the profiler or deprecation log enabled; verify that deprecation warnings for mod* classes from this schema no longer appear. Optionally rebuild the model from the updated schema and confirm the map uses FQCN.
Related issue(s)/PR(s)
None.