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

Hey. A little bit stuck here, help would be appreciated! I have written a composer library (lets st

Options
U0134CBTUKS
U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
edited August 2020 in Slack General

Hey. A little bit stuck here, help would be appreciated!
I have written a composer library (lets stay Lib) and I'm trying to load service in Zed that extends spryker as usual (e.g vendor/Lib/Service/UtilTextService), when I provide it in Dependency provider in zed it can't find it - just finds Spryker one.
I added my "Lib" namespace to CORE_NAMESPACES. What did I miss?

Comments

  • UP3PTBA3F
    UP3PTBA3F Posts: 4 🧑🏻‍🚀 - Cadet
    Options

    hi, maybe try composer dump-autoload -o

  • U0134CBTUKS
    U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
    edited August 2020
    Options

    hey, sadly tried it and still get
    Return value of Lib\Zed\Module\DependencyProvider::Lib\Zed\Module{closure}() must be an instance of Lib\Service\UtilText\UtilTextServiceInterface, instance of Spryker\Service\UtilText\UtilTextService returned

  • UP3PTBA3F
    UP3PTBA3F Posts: 4 🧑🏻‍🚀 - Cadet
    edited August 2020
    Options

    then check what you have as a return of our method. Maybe you return something from vendors. not from your classes

  • U0134CBTUKS
    U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
    Options

    when I do

    $container->set(static::SERVICE_UTIL_TEXT, static function (Container $container): UtilTextServiceInterface {
        return new UtilTextService(); (Lib namespace)
    });
    

    it works 😕 locator can't find it

  • U0134CBTUKS
    U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
    Options

    with

    return $container->getLocator()->utilText()->service();
    
  • UP3PTBA3F
    UP3PTBA3F Posts: 4 🧑🏻‍🚀 - Cadet
    Options

    I think it is a just a return type issue. Need to see a full code to say mo exact

  • U0134CBTUKS
    U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
    edited August 2020
    Options

    both return types in dependency provider and business factory has Lib namespace if it weren't the "new UtilTextService" would fail too

  • UP3PTBA3F
    UP3PTBA3F Posts: 4 🧑🏻‍🚀 - Cadet
    Options

    maybe inside UtilTextService() class you init the vendor one and return it

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 🧑🏻‍🚀 - Cadet
    Options

    stupid question but is your lib following conventions -> file naming, file position, implementing interfaces, extending proper base classes etc

  • U0134CBTUKS
    U0134CBTUKS Posts: 42 🧑🏻‍🚀 - Cadet
    Options

    everything looks as ok as usual, nvm I'll try to debug locator