Guite / MostGenerator

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

Capabilities error in 1.4 module #691

Closed Guite closed 8 years ago

Guite commented 8 years ago

@rallek got the following error message when installing a module:

Capabilities-Eigenschaften müssen ein Array sein in der Form array(capability => array(version => string, ... => ... in RK\InfoModule\InfoModuleVersion

Probably caused by recent addition of categorizable.

The corresponding code looks like this:

        $meta['capabilities'] = array(
              'categorizable' => array(
                  'RK\InfoModule\Entity\informationEntity',
              ),
              HookUtil::SUBSCRIBER_CAPABLE => array('enabled' => true)
        );

@cmfcmf @craigh any idea?

rallek commented 8 years ago

I got this error while opening the extension module already

craigh commented 8 years ago

This is a generated 1.4 module? using what version of MOST? I thought there was no compatible release?

rallek commented 8 years ago

webgen. Just a try

Guite commented 8 years ago

@craigh the webgen allows always regenerating your model using the latest git version of the generator. You may read http://modulestudio.de/en/news/modulestudio-launches-service-for-web-based-generation.html for more details.

craigh commented 8 years ago

ok - please translate the error.

Guite commented 8 years ago

somehow Christian must have gotten the new Routes module, too ;-)

rallek commented 8 years ago

raw translation:

Capabilities-properties must be an arry in the format(capability => array(version => string, ... => ... in RK\InfoModule\InfoModuleVersion

cmfcmf commented 8 years ago
$meta['capabilities'] = array(
              'categorizable' => array(
                  'blubb' => 'RK\InfoModule\Entity\informationEntity',
              ),
              HookUtil::SUBSCRIBER_CAPABLE => array('enabled' => true)
        );

should work.

cmfcmf commented 8 years ago

(replace "blubb" by something more.. intelligent.)

craigh commented 8 years ago

That isn't how I originally intended it. it should be

      "capabilities": {
        "hook_subscriber": {"enabled": true},
        "searchable": {"class": "Zikula\\PagesModule\\Helper\\SearchHelper"},
        "categorizable": ["Zikula\\PagesModule\\Entity\\PageEntity"],
        "user": {"route": "zikulapagesmodule_user_index"},
        "admin": {"route": "zikulapagesmodule_admin_index"}
      },

so that there can be multiple entities in the array. e.g.

        "categorizable": [
            "Zikula\\PagesModule\\Entity\\PageEntity",
            "Zikula\\PagesModule\\Entity\\FooEntity",
            "Zikula\\PagesModule\\Entity\\BarEntity"
        ],

if that isn't working then there is a problem somewhere.

cmfcmf commented 8 years ago

Capabilities must be Arrays of Arrays, this is how it is designed. Search for "capabilities must be" in the core.

Craig Heydenburg notifications@github.com schrieb am Mo., 21. Sep. 2015 01:48:

That isn't how I originally intended it. it should be

  "capabilities": {
    "hook_subscriber": {"enabled": true},
    "searchable": {"class": "Zikula\\PagesModule\\Helper\\SearchHelper"},
    "categorizable": ["Zikula\\PagesModule\\Entity\\PageEntity"],
    "user": {"route": "zikulapagesmodule_user_index"},
    "admin": {"route": "zikulapagesmodule_admin_index"}
  },

so that there can be multiple entities in the array. e.g.

    "categorizable": [
        "Zikula\\PagesModule\\Entity\\PageEntity",
        "Zikula\\PagesModule\\Entity\\FooEntity",
        "Zikula\\PagesModule\\Entity\\BarEntity"
    ],

if that isn't working then there is a problem somewhere.

— Reply to this email directly or view it on GitHub https://github.com/Guite/MostGenerator/issues/691#issuecomment-141845826 .

craigh commented 8 years ago

Capabilities must be Arrays of Arrays,

it IS. It just doesn't have associative keys in the final array. see below.

$meta['capabilities'] = array(
              'categorizable' => array('RK\InfoModule\Entity\informationEntity'),
              HookUtil::SUBSCRIBER_CAPABLE => array('enabled' => true)
        );
Guite commented 8 years ago

So this would be correct?

$meta['capabilities'] = array(
              'categorizable' => array(
                  'information' => 'RK\InfoModule\Entity\InformationEntity',
                  'otherEntity' => 'RK\InfoModule\Entity\OtherEntityEntity'
              )
        );
cmfcmf commented 8 years ago

it IS. It just doesn't have associative keys in the final array. see below.

Ok, it must have associative keys then. See https://github.com/zikula/core/blob/master/src/lib/legacy/Zikula/AbstractVersion.php#L505-505

cmfcmf commented 8 years ago

@guite Yes this should work.

Guite commented 8 years ago

Fixed in fa881e41c9cabbbcf0c9a635db9da3a3f851acc5