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..

Hi! I would like to extract a Spryker module I created into another Git repo and to require it throu

Options
U044S668NPR
U044S668NPR Posts: 17 🧑🏻‍🚀 - Cadet

Hi! I would like to extract a Spryker module I created into another Git repo and to require it through composer. It looks like Sprkyer is not looking into vendor/foobar/src/Pyz/... but only into "Spryker" directories (especially thinking about Zed controller and routes). Is there any way to achieve this?

Comments

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    You should overthink your vendor structure. For vendor packages you should adopt the spryker directories. for example vendor/vendor-name/src/package-name/VendorName/Zed/PackageName. Then you have to adjust on pyz the configuration for the new paths

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    KernelConfig for example check the getPathsToCoreModules() function

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    Also for router, twig, es, transfer, zed navigation etc

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    in global config file you also have to register the new namespace (

    KernelConstants::PROJECT_NAMESPACES
    KernelConstants::CORE_NAMESPACES
    
  • U044S668NPR
    U044S668NPR Posts: 17 🧑🏻‍🚀 - Cadet
    Options

    Thanks for the hints! getPathsToCoreModules seems like the wrong place, since my module is not a core module, isn't it? Shouldn't it rather be getPathsToProjectModules 🤔

  • U044S668NPR
    U044S668NPR Posts: 17 🧑🏻‍🚀 - Cadet
    Options

    Do you know if there is any documentation about this?

  • U044S668NPR
    U044S668NPR Posts: 17 🧑🏻‍🚀 - Cadet
    edited October 2022
    Options

    I did what you said: added the Namespace to the CORE_NAMESPACES and also the path to getPathsToCoreModules..
    Anyway the backoffice and gateway routes cannot be found 🤷

  • U044S668NPR
    U044S668NPR Posts: 17 🧑🏻‍🚀 - Cadet
    Options

    Forget what I said.. I was accessing the wrong route, since I was renaming my module before 🤦
    With adding at these two places it works perfectly fine :)

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    doesnt matter if its core module or not, you can add the paths there. Dunno if its documented. We create and add own vendor modules and had to take a closer look into the code to find the loading parts