Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2024 at 21:32 UTC
Updated:
19 Nov 2024 at 17:20 UTC
Jump to comment: Most recent
In #3397522: Fork Symfony's ContainerAwareTrait and ContainerAwareInterface into core we are trying to reduce the use of ContainerAwareTrait as Symfony has deprecated it.
StreamWrapperManager is container aware because it needs to retrieve stream wrapper services by ID.
Instead of injecting the entire container we can inject a service locator that only knows about stream wrapper services.
Inject a service locator from RegisterStreamWrappersPass.
Convert StreamWrapperManager to accept a service locator instead of being fully container aware.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
longwaveComment #4
andypostThank you, looks it needs CR but up to commiter
Comment #5
dpiPut together a similar locator in #3408433: Use a service locator to group hooks services together to ease future privatization and lazy loading recently so can say LGTM.
Only one optional hyper- nit. Leaving as RTBC.
Comment #6
longwaveFixed the nit, added a CR: https://www.drupal.org/node/3414687
Comment #8
catchNifty, didn't realise this had been possible since Symfony 3.3.
Committed/pushed to 11.x, thanks!
Comment #9
andypostPlease close MR
Comment #11
longwaveComment #13
cmlaraNote for those who come across this issue in the future:
This did cause a break in D10.3 when streamWrappers were registered as part of a second compiler pass
Service "stream_wrapper.myscheme" not found: the container inside "Drupal\Core\StreamWrapper\StreamWrapperManager" is a smaller service locator that only knows about the "stream_wrapper.assets", "stream_wrapper.private", "stream_wrapper.public" and "stream_wrapper.temporary" services.In my case (s3fs) it appears it may be easy enough to fix by moving to ServiceProviderInterface::register() however it is a refactoring on minor upgrade.
Comment #14
itsbakiya commentedFacing same issue we #13.
Any solution to fix this
Comment #15
cmlara#3461207: D10.3 StreamWrapperManager change to Service Locators breaks with second compiler pass was where s3fs fixed this, basically you have to make sure you register your services before the first compiler pass completes and the closures are generated hence the move into register().