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 everybody, is there a recommended way pulling plugins as a dependency to another module when t
Hello everybody,
is there a recommended way pulling plugins as a dependency to another module when the plugin itself has dependencies? I want to use that code of this plugin in my own module. Usually, the plugin has no dependencies at all (no constructor params), but now i hit encounter a spryker plugin that has DI params which is a new situation to me β¦ any ideas how to deal with it? π€ the class is the spryker yves CustomerAuthenticationFailureHandler.
Best
Comments
-
Iβd say Plugins should not be considered as Services you should deal with DI
0 -
Plugins from a conceptual point of view are a layer for more dynamic βDIβ wiring in a way?
0 -
That does not solve your issue here though, I guess π
0 -
Hi Andreas. That means, the plugins dependecies itself should also be defined as a dependency in the DI of the module the plugin is pulled to?
0 -
Plugins, PluginStack, etc though are often residing in PyZ for a reason. To be explicitly managed, Iβd say
0 -
Wait, itβs not directly a plugin, but a handler class, residing in a Plugin namespace π€
0 -
That was also my feeling β¦ not really a plugin
0 -
At least not in the sense of sprykers βuse it in other modulesβ approach^^
0 -
yep. meaning nope π
0 -
But you need to get access to that service instance to inject it somewhere for sure?
0 -
I wrote a new authenticator but moved to another module for that β¦ the authenticator should handle success and errors as before so the idea was to use the handler-plugins in my module β¦ but thats not possible with this dependency β¦ i think ill move from the new module back in the origin modules space so i can instantiate the handlers via the factories β¦ might not be the best solution but less stressfull i guess^^
0 -
oooor you implement your own
\Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface
π€0 -
Yeah β¦ just want to avoid a copycat/code duplication^^
0 -
Or go with the approach you initially thought about. Pulling in the dependencies for the handler and instantiate it within your module. A bit of tech smell, but thatβs probably for all the options you have
0 -
Well, what would be the worst impact of that?
0 -
The handler isnβt doing as much
0 -
I think the cleanest option would be to stick to the origin module with my new authenticator as long as there is no need to separate it as a module that can be used in other projects β¦ for the moment there isnt such a requirement β¦ but perspectively it would be nice to have a clean dependency on that and just add a composer dep for that
0 -
Or go with the approach you initially thought about. Pulling in the dependencies for the handler and instantiate it within your module. A bit of tech smell, but thatβs probably for all the options you have
The thing is, the DI itself would be a dependency .. in this case the messenger β¦ so if i would it also add to the dependency provider as well, i think there is a smell since there is the chance that the dep is not loaded yet
0 -
Not sure if I can fully follow. Making the feature you worked on a standalone module, having a dependency to that auth handler sounds like a risk though, yes.
0 -
Yeah but a clearly defined one^^i mean its always a tradeoff β¦ if i donβt want to re-implement a feature that already behaves as i want, i get some kind of dependency to it β¦ i think thats the price^^
0 -
yep π
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 77 Spryker News
- 939 Developer Corner
- 795 Spryker Development
- 90 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
- 28 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
- 33 Product & Business Questions
- 69 Spryker Safari Questions
- 50 Random