Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello all, I have added (copy/pasted) a module in spryker-eco folder but its classes are not being l

Options
U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

Hello all, I have added (copy/pasted) a module in spryker-eco folder but its classes are not being loaded in Zed. Can someone please tell me what I might be missing?

Comments

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet
    Options

    namespaces? cache? (cache:class-resolver:build)

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @UNGMX0012 Can you please elaborate on namespaces?

    I am trying to access some constants in default_config file like this:

    use SprykerEco\Shared\AkeneoPim\AkeneoPimConstants;
    
    ...
    
    $config[AkeneoPimConstants::HOST] = '[abc.cloud.akeneo.com](http://abc.cloud.akeneo.com)';
    $config[AkeneoPimConstants::USERNAME] = 'ab2344';
    ...
    

    After this, when I run console cache:class-resolver:build, I get:

    PHP Fatal error: Uncaught Error: Class "SprykerEco\Shared\AkeneoPim\AkeneoPimConstants" not found in /data/config/Shared/config_default.php:133

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    This is what I have in the vendor directory

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    @U048WDEP3R7 can you check, if the module is there inside of the docker container? e.g. execute docker/sdk cli ls -la vendor/spryker-eco

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    it seems to be an autoloading issue, so if it is actually present, you can try to rebuild the composer autoloader with: docker/sdk cli composer dump-autoload

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    and if you have not done so anyway, I would recommend executing composer inside of the docker container, when you install modules. with docker/sdk cli composer require spryker/eco-... (instead of running it locally)

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @U01BZ7Q3XRV thanks for pointing that out. I just checked and it is there. I also did dump-autoload from the CLI

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @U01BZ7Q3XRV I manually copy/pasted these modules in the spryker-eco folder. Does this make a difference?

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    ah, yes it does. because the composer installation process does more then just copying the files. So if the dump-autoload command did not work, this is probably because composer is not aware that the module exists in your directory, and so the autoload file is not genreated for this module

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    so in theory, if you remove the directory again, and then install it with docker/sdk cli composer require spryker-eco/akeneo-pim-middleware-connector it should work

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    in case you do not get any version conflicts

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @U01BZ7Q3XRV I actually copy pasted them because I was getting version conflicts with composer. Is there a workaround?

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    you can try adding the "update with dependencies" flag to the composer require command. first with "-w" and if that does not work with "-W" (in capital)

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    it will try to update the required dependencies. There might still be errors, then you have to manually check the modules, that are throwing errors, I guess.

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @U01BZ7Q3XRV I actually tried the modules require PHP 7.3 where as I am using 8. So they can not get installed via composer. This is why I manually downloaded the source code. Can you please tell me what can we do to manually integrate the modules from Spryker-Eco? Or maybe I should create copies, rename the namespaces to custom namespace and then use them directly in Zed etc?

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    yes, I fear then the module is just too outdated for a newer spryker installation. You can try to move it to your project namespace, yes. In that case you can keep the SprykerEco namespace (so put it under src/SprykerEco) I think to have it a bit separated from your actual project code. Or of course you can also migrate it to your porject namespace. If you use the SprykerEco namespace, you just have to make sure, that in your config/Shared/config_default.php SprykerEco is included in the namespaces:

    $config[KernelConstants::CORE_NAMESPACES]
    

    But it should be there already, I think

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    I think then it should work to just copy the contents of vendor/.../.../src/SprykerEco to src/SprykerEco

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    ah, one more thing, you probably then also have to add SprykerEco to

    $config[KernelConstants::PROJECT_NAMESPACES] 
    

    in your config_default.php

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    then the spryker autoloader should be able to locate them

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    Thanks @U01BZ7Q3XRV. This helps a lot.

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 🧑🏻‍🚀 - Cadet
    Options

    suer 🙂 no problem

  • U044UNCCTDH
    U044UNCCTDH Posts: 18 🧑🏻‍🚀 - Cadet
    edited April 2023
    Options

    Hi, I've just finished Akeneo PIM installation. I've installed akeneo-pim-middleware package with composer - there is no PHP 8 compatible package, but on GH is fix, so I downloaded it on hard drive and install with composer locally.
    According to the documentation https://docs.spryker.com/docs/pbc/all/product-information-management/202212.0/third-party-integrations/akeneo/akeneo-console-commands.html this console commands should works as OOTB, but i get only exception : Error - Exception: Call to undefined method SprykerEco\Zed\AkeneoPimMiddlewareConnector\Communication\Plugin\Configuration\SuperAttributeImportConfigurationPlugin::getProcessConfigurationPlugins()
    in /data/vendor/spryker-middleware/process/src/SprykerMiddleware/Zed/Process/Business/PluginResolver/ProcessPluginResolver.php (32)

    I try, just for a testing purpose, put this undefined method to SuperAttributeImportConfigurationPlugin. Result is that, I get new not found exception:
    Spryker\Zed\Kernel\Exception\Container\ContainerKeyNotFoundException - Exception: Spryker Kernel Exception
    Container does not contain the called "AKENEO_PIM_MIDDLEWARE_CATEGORY_IMPORTER_PLUGIN"
    You can fix this by adding the key "AKENEO_PIM_MIDDLEWARE_CATEGORY_IMPORTER_PLUGIN" to your "AkeneoPimMiddlewareConnectorDependencyProvider"
    in /data/vendor/spryker/kernel/src/Spryker/Zed/Kernel/BundleDependencyProviderResolverAwareTrait.php (51)
    However "AKENEO_PIM_MIDDLEWARE_CATEGORY_IMPORTER_PLUGIN" exists in "AkeneoPimMiddlewareConnectorDependencyProvider" so I don't know where problem is.