Skip to content

Commit

Permalink
Update for oxid 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
leofonic committed Apr 17, 2020
1 parent d72629c commit 66a1ac3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -24,7 +24,7 @@
},
"require": {
"php": ">=5.6",
"oxid-esales/oxideshop-ce": "^v6.0"
"oxid-esales/oxideshop-ce": "^v6.2"
},
"autoload": {
"psr-4": {
Expand Down
21 changes: 20 additions & 1 deletion core/Config.php
Expand Up @@ -2,6 +2,9 @@

namespace zunderweb\autoregister_namespaces\core;
use oxRegistry;
use OxidEsales\Eshop\Core\Module\Module;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridgeInterface;

class Config extends Config_parent
{
Expand All @@ -20,7 +23,7 @@ public function init()
$aPrefixesToLoad = oxRegistry::getUtils()->fromFileCache('zwb_autoload_namespaces');
if ($aPrefixesToLoad === null || !$this->getConfigParam('blZwarProductionMode')){
$loadedPrefixes = $loader->getPrefixesPsr4();
$modulePaths = $this->getConfigParam('aModulePaths');
$modulePaths = $this->z_getModulePaths();
$modulesDir = $this->getModulesDir(true);
$aPrefixesToLoad = array();
if (is_array($modulePaths)){
Expand Down Expand Up @@ -54,4 +57,20 @@ public function init()
}
stopProfile('autoregister_namespaces');
}

private function z_getModulePaths(): array
{
$container = ContainerFactory::getInstance()->getContainer();
$shopConfiguration = $container->get(ShopConfigurationDaoBridgeInterface::class)->get();

$modules = [];

foreach ($shopConfiguration->getModuleConfigurations() as $moduleConfiguration) {
$module = oxNew(Module::class);
$path = $moduleConfiguration->getPath();
$modules[] = $path;
}

return $modules;
}
}

0 comments on commit 66a1ac3

Please sign in to comment.