Skip to content

Commit f598699

Browse files
authored
Use FQCN in modResource and modUser (#16919)
### What does it do? Replaces two remaining short `mod*` class name strings in core xPDO calls with FQCN: - `modResource::isPreviewable()` — `getObject('modResource', …)` → `getObject(modResource::class, …)` - `modUser::getResourceGroups()` — `loadAttributes(['modAccessResourceGroup'], …)` → `loadAttributes([modAccessResourceGroup::class], …)` Earlier iterations that changed the schema or added `modX::loadClass()` normalization were reverted per review feedback. ### Why is it needed? MODX 3.0 deprecates short `mod*` class names in favor of PSR-4 FQCN. These two core call sites still passed bare strings into xPDO, which could trigger deprecation notices in the profiler. Fixing them at the call site follows the intended v3.0 migration path without masking warnings globally. ### How to test 1. Enable the profiler or deprecation log. 2. Exercise resource preview checks (`modResource::isPreviewable()`). 3. Exercise user resource group loading (`modUser::getResourceGroups()`, used via `modResourceGroup::hasAccess()`). 4. Confirm no v3.0 short-class deprecation warnings from these paths. ### Related issue(s)/PR(s) None.
1 parent 6f6b755 commit f598699

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

core/src/Revolution/modResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ public function canPreviewResource($targetId, $sourceId = null): bool
16911691
return false;
16921692
}
16931693
$targetIsSelf = $sourceId === null || (int)$targetId === (int)$sourceId;
1694-
if ($doc = $this->xpdo->getObject('modResource', $targetId)) {
1694+
if ($doc = $this->xpdo->getObject(modResource::class, $targetId)) {
16951695
if (!$doc->deleted) {
16961696
return true;
16971697
}

core/src/Revolution/modUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ public function getResourceGroups($ctx = '')
623623
if (isset($_SESSION["modx.user.{$id}.resourceGroups"][$ctx])) {
624624
$resourceGroups = $_SESSION["modx.user.{$id}.resourceGroups"][$ctx];
625625
} else {
626-
$this->loadAttributes(['modAccessResourceGroup'], $ctx, true);
626+
$this->loadAttributes([modAccessResourceGroup::class], $ctx, true);
627627
if (isset($_SESSION["modx.user.{$id}.resourceGroups"][$ctx])) {
628628
$resourceGroups = $_SESSION["modx.user.{$id}.resourceGroups"][$ctx];
629629
}

0 commit comments

Comments
 (0)