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, How to debug the following error ```Spryker\Glue\Kernel\ClassResolver\DependencyProvider\Depe
Hello,
How to debug the following error
Spryker\Glue\Kernel\ClassResolver\DependencyProvider\DependencyProviderNotFoundException - Exception: Spryker Kernel Exception Can not resolve NgcategoryRestApiDependencyProvider for your module "NgcategoryRestApi" You can fix this by adding the missing DependencyProvider to your module.
Comments
-
Create a file named
NgcategoryRestApiDependencyProvider
in the top level of your module, that looks like:<?php namespace Pyz\Glue\NgcategoryRestApi; use Spryker\Glue\Kernel\AbstractBundleDependencyProvider; use Spryker\Glue\Kernel\Container; /** * @method \Pyz\Glue\NgcategoryRestApi\NgcategoryRestApiConfig getConfig() */ class NgcategoryRestApiDependencyProvider extends AbstractBundleDependencyProvider { /** * @param \Spryker\Glue\Kernel\Container $container * * @return \Spryker\Glue\Kernel\Container */ public function provideDependencies(Container $container) { $container = parent::provideDependencies($container); return $container; } }
0 -
Your DependencyProvider must be at the root of your module
• NgcategoryRestApi folder
◦ NgcategoryRestApiDependencyProvider.php
◦ NgcategoryRestApiConfig.php0 -
Thanks for replay,
I have already created the files withe the needful dependencies, I following category-rest-api module . Kindly provide more suggestions so that I can fix this.0 -
You named the Dependency Provider
NgcategoriesRestApiDependencyProvider
, but your module is namedNgcategoryRestApi
so the correct name for the dependency provider would beNgcategoryRestApiDependencyProvider
.
You should stick to one name either singular or plural. Suggestion from Spryker is to stick with the plural form.0 -
good catch @UL6DGRULR 👍
0 -
@UL6DGRULR Thankyou very much
My bad, it was silly mistake by the way that error is gone but now another exception
0 -
NgcategoryRestApiDependencyProvider.php
<?php namespace Pyz\Glue\NgcategoryRestApi; use Pyz\Glue\NgcategoryRestApi\Dependency\Client\NgcategoryRestApiToStoreClientBridge; use Pyz\Glue\NgcategoryRestApi\Dependency\Client\NgcategoryRestApiToCategoryStorageClientBridge; use Spryker\Glue\Kernel\AbstractBundleDependencyProvider; use Spryker\Glue\Kernel\Container; class NgcategoryRestApiDependencyProvider extends AbstractBundleDependencyProvider { /** * @var string */ public const CLIENT_CATEGORY_STORAGE = 'CLIENT_CATEGORY_STORAGE'; /** * @var string */ public const CLIENT_STORE = 'CLIENT_STORE'; /** * @param \Spryker\Glue\Kernel\Container $container * * @return \Spryker\Glue\Kernel\Container */ public function provideDependencies(Container $container): Container { $container = parent::provideDependencies($container); $container = $this->addCategoryStorageClient($container); $container = $this->addStoreClient($container); return $container; } /** * @param \Spryker\Glue\Kernel\Container $container * * @return \Spryker\Glue\Kernel\Container */ public function addCategoryStorageClient(Container $container) { $container->set(static::CLIENT_CATEGORY_STORAGE, function (Container $container) { return new NgcategoryRestApiToCategoryStorageClientBridge( $container->getLocator()->categoryStorage()->client(), ); }); } /** * @param \Spryker\Glue\Kernel\Container $container * * @return \Spryker\Glue\Kernel\Container */ protected function addStoreClient(Container $container): Container { $container->set(static::CLIENT_STORE, function (Container $container) { return new NgcategoryRestApiToStoreClientBridge( $container->getLocator()->store()->client(), ); }); return $container; } }
0 -
- don't use bridges on Project level, they are a workaround in the core for the missing interface segregation principle but are not necessary in the project as strict segregation is not a matter in the project namespace.
- Your issue is that
addCategoryStorageClient
does not return the container (doc block tells wrongly that it does), which is an issue the IDE already points out in line 41
0 -
Note: the stack trace exactly tells you the error that NULL is passed into
addStoreClient
, please read your error messages carefully before you ask for help.0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random