Skip to content

Commit

Permalink
Small tweak to use namespace case convention for 3.x, and add an extr…
Browse files Browse the repository at this point in the history
…a possible namespace format.
  • Loading branch information
muzzwood committed Mar 16, 2023
1 parent cea9319 commit 9b4827f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,16 @@ public function buildObjects($folder, $type)

$this->resolveConflicts($folder, $type);

if (
class_exists('\modX\Revolution\modNamespace') &&
in_array($type['class'], ['modNamespace', '\modNamespace', '\modX\Revolution\modNamespace'], true)
) {
$this->modx->getCacheManager()-> generateNamespacesCache('namespaces');
\modX\Revolution\modNamespace::loadCache($this->modx);
// Due to autoloading via namespaces (bootstrap.php) in MODX 3.x, rebuild namespace cache.
$namespaces = [
'modNamespace',
'\modNamespace',
'MODX\Revolution\modNamespace',
'\MODX\Revolution\modNamespace',
];
if (class_exists('\MODX\Revolution\modNamespace') && in_array($type['class'], $namespaces, true)) {
$this->modx->getCacheManager()->generateNamespacesCache('namespaces');
\MODX\Revolution\modNamespace::loadCache($this->modx);
}
}

Expand Down

0 comments on commit 9b4827f

Please sign in to comment.