HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search
-
Re: Call Method from Multiple Implementations
As far as I have understood it, using factory is deprecated and dependency injection is used instead: https://github.com/vanilla/vanilla/issues/7459 Maybe you find some inspiration looking 1. at the new Container class in /vendor/vanilla/garden-container/src/Container.php or 2. directly at the repo:… -
Re: Call Method from Multiple Implementations
I "grew up" with computers that had very limited memory resources and therefore I always tend to store only what is needed. I would only store the class name and use the addon itself as the container. I even thought of using Gdn::set('FunImplementations', ... as the container :mrgreen: But from my understanding the clean… -
Re: Call Method from Multiple Implementations
I guess I would have done it the other way around: instead of creating a "loader" class, I would have created a "container" class and added a register() method to the interface, forcing each implementation to add itself to the container. From the addon I then would have taken a look at the container and which… -
Re: Call Method from Multiple Implementations
@R_J, that might be cleaner than storing their class names in an array, which I used for retrieving each shared instance that gets instantiated when get($className) is called on the Garden container. In both cases, the files would still have to be loaded/required from the "FunImplementations" folder, but the Loader code… -
Re: Call Method from Multiple Implementations
I didn't know that the Garden Container was added. This is amazing! Thanks for the info, @R_J! =) I came up with a solution for this issue using this. In my case, FunImplementations should be loaded dynamically as more can be dropped into the folder at any time. Knowing that Vanilla autoloads classes before the addon's…
5 results