- Issue created by @sidharth_soman
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 8:25am 13 July 2023 - 🇮🇳India sidharth_soman Bangalore
I have added the DI for MetaClient.php. I'm holding off on doing it for MetaApiTwig.php for now since it seems like a manual method to access the MetaClient service was implemented instead. I'll change it as per your request if it's really required.
In the meantime, please review the patch.
- 🇬🇧United Kingdom Rob230
The advice I've seen is not to have the request stack as a required in the constructor because it's only available for HTTP requests, so may not be available in tests. The pattern of having getters and setters which optionally set it on creation if it's available is is how it's done elsewhere in Drupal (Forms, Views).
On the other hand, we are currently using the Request object without checking it exists, and the code isn't going to work without it, so it probably does make sense to inject it, and get the current request at time of use only, not at time of construction.
- Status changed to Fixed
over 1 year ago 4:20pm 15 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.