Guite / MostGenerator

Transformation cartridges for generating Symfony bundles from ModuleStudio models.
https://modulestudio.de
23 stars 2 forks source link

Installed module not included in kernel module map #362

Closed Guite closed 11 years ago

Guite commented 11 years ago

When targeting 1.3.6 then ModUtil::isOO() returns false for the generated module. Usually the following condition should become true:

            } else if (self::getModule($moduleName)) {
                self::$ooModules[$moduleName]['oo'] = true;
            }

The getModule method includes the following check:

        $kernel = ServiceUtil::getManager()->get('kernel');
        try {
            return $kernel->getModule($moduleName);
        } catch (\InvalidArgumentException $e) {
        }

Some debugging shew that the InvalidArgumentException happens, but this is not visible as it is caught silently.

The output of

die('TEST: ' . print_r(array_keys($this->moduleMap)));

includes AcmeExampleModule, but not GuiteAutoMusicModule (example model).

So obviously something is missing in the generated module - but what?

Guite commented 11 years ago

@drak @cmfcmf @phaidon

cmfcmf commented 11 years ago

No idea :-) However it should work if you add it to https://github.com/zikula/core/blob/1.3/src/app/ZikulaKernel.php by hand. I don't know if auto-adding is already implemented. @drak

ghost commented 11 years ago

Is the composer.json correct?

cmfcmf commented 11 years ago

I might be wrong, but I tried to test Symfony routing and with the AcmeExampleModule and tried to use @AcmeExampleModule/Controller in routing.yml, it always said "bundle not registered" (or similar).

ghost commented 11 years ago

Symfony routing is not enabled. Maybe the composer.json is not correctly formed - that is a common reason.

cmfcmf commented 11 years ago

This is how it looks like (composer validate says it is ok):

{
    "name": "cmfcmf/usagestatistics",
    "description": "CmfcmfUsageStatisticsModule module generated by ModuleStudio 0.6.1.",
    "version": "1.0.0",
    "type": "zikula-module",
    "license": "LGPL-3.0+",
    "authors": [
        {
            "homepage": "https://www.github.com/cmfcmf/UsageStatistics"
        }
    ],
    "autoload": {
        "psr-0": { "Cmfcmf\\UsageStatisticsModule\\": "" }
    },
    "require": {
        "php": ">5.3.3"
    },
    "suggest": {
    },
    "extra": {
        "zikula": {
            "class": "Cmfcmf\\UsageStatisticsModule\\CmfcmfUsageStatisticsModule"
        }
    }
}

BTW: I know Routing is not enabled. I enabled it 'by hand'.

ghost commented 11 years ago

You can email me the zip of the module, but I cant look till much later today or tomorrow.

ghost commented 11 years ago

Btw- you should call it name: "cmfcmf/usage-statistics"

cmfcmf commented 11 years ago

I just tried placing the following code in index.php and the two MOST-1.3.6 generated modules as well as the example module return true

$x = ModUtil::isOO('AcmeExampleModule');
$y = ModUtil::isOO('CmfcmfUsageStatisticsModule');
$z = ModUtil::isOO('ZikulaOAuthModule');
var_dump($x);
var_dump($y);
var_dump($z);

So @Guite you should send your module to @drak.

cmfcmf commented 11 years ago

Should be fixed by https://github.com/zikula/core/pull/1096.

Guite commented 11 years ago

Works indeed :+1: