Problem/Motivation
Follow up #2729597: [meta] Replace \Drupal with injected services where appropriate in core
Proposed resolution
Replace all of them with IoC injection where possible
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 3158753-17.patch | 1.83 KB | ranjith_kumar_k_u |
| #5 | interdiff_2-5.txt | 5.84 KB | suresh prabhu parkala |
| #5 | 3158753-5.patch | 8.71 KB | suresh prabhu parkala |
| #2 | 3158753-2.patch | 1.83 KB | hardik_patel_12 |
Comments
Comment #2
hardik_patel_12 commentedKindly review a patch.
Comment #3
msutharsComment #4
msuthars@Hardik_Patel_12 I reviewed the patch and found some changes:
1.
FileWidgetis pending for Ioc service, you can injectmessengerservice in it.2.
FileModuleTestFormis pending for Ioc service, you can user$this->messenger()in it.3.
PrepareModulesEntityUninstallFormis pending for Ioc service, you can user$this->messenger()in it.4.
FormTestControllerObjectis pending for Ioc service, you can user$this->messenger()in it.5.
PagerTestControlleris pending for Ioc service, you can user$this->messenger()in it.6.
BatchUserActionis pending for Ioc service, you can user$this->messenger()in it.Comment #5
suresh prabhu parkala commentedUpdated as per #4. Please review.
Comment #6
hardik_patel_12 commented@msuthars , thanks for the review . As you have suggested some changes in #4 , can you kindly look my following points
1. In FileWidget file \Drupal::messenger( call is under static method , so no need to replace this.
2. We are replacing IoC injection in non test files only.
3. In PrepareModulesEntityUninstallForm file \Drupal::messenger( call is under static method , so no need to replace this.
4. Same as point 2.
5. Same as point 2.
6. In BatchUserAction \Drupal::messenger( call is under static method , so no need to replace this.
Comment #7
msutharsComment #8
msuthars@Hardik_Patel_12 thanks to make clear about my suggestions. The patch #2 looks good to me other then that, moving to RTBC.
Comment #9
alexpottWe need to think about BC here. I.e. allow a null and then trigger a deprecation and use \Drupal if it is. Which means this needs a CR.
Comment #10
hardik_patel_12 commented@alexpott , we are not injecting messenger service in FileWidget.php file as \Drupal::messenger call is in static method. Can you please review patch at #2 and points suggested in #6.
Comment #11
junglePer the parent issue, rescoping this to do it for non-test code.
Comment #17
ranjith_kumar_k_u commentedRerolled #2 for 10.1
Comment #18
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
Based on the title what is the correct approach #2 or #5 or a combo of both.
Also this was tagged for change record so moving back to NW.