Closed yellow1912 closed 3 years ago
I have just updated my code to the loading the compiler pass, seems to work ok
Hi, thanks for your effort! Is it possible to make a PR so we can discuss the topic over there?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Currently, the custom adapter and cache services are loaded via tagging, however this method has an issue with loading order: if the bundle that needs to add custom services is loaded after the flysystem bundle then it won't work.
I believe it would be better to move this whole loading to compiler passes if possible since they are loaded after all bundles have been loaded. However, there is another issue with that way of loading: the Configuration file current requires the list of all adapters and caches (for validation purpose) and thus would not be available using the above method.
I have a potential fix here:
https://github.com/Nilead/OneupFlysystemBundle/blob/master/DependencyInjection/OneupFlysystemExtension.php
The code base is rather old (which I can update) but the idea is that we can allow defining custom adapter and cache classes which can be initialized directly (so that the validation can be used right away).
Other than that, another idea is to delay validation of custom adapters and caches till compiler pass.