Closed (fixed)
Project:
Content Planner
Version:
8.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
19 Jul 2022 at 17:23 UTC
Updated:
31 Oct 2022 at 14:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
soham sengupta commentedAssigning it to my name.
Comment #3
soham sengupta commentedComment #4
Joel Guerreiro Borghi Filho commentedWill try to work on this one =)
Comment #5
Joel Guerreiro Borghi Filho commentedAfter running phpcs I found another possible D.I. issue:
FILE: /modules/contrib/content_planner/src/ContentModerationService.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
74 | WARNING | ContentModerationState::loadMultiple calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------
Changing status to needs work.
Comment #6
dieterholvoet commentedYou usually change the status to Needs work if an issue needed a review and after reviewing it was determined that changes are needed. This issue doesn't have a patch or MR, so changing back to Active.
Comment #7
Joel Guerreiro Borghi Filho commentedAlright @DieterHolvoet, rookie here, I'm sorry, and thanks for the clarification.
Comment #8
Joel Guerreiro Borghi Filho commentedPatch for #5.
Kindly review.
Comment #9
dieterholvoet commentedThat's a good start! Let's refactor the other examples in the issue description as well, and any other places I might have missed.
Comment #10
Joel Guerreiro Borghi Filho commented@DieterHolvoet, nice, I will keep working on this then =).
Comment #11
Joel Guerreiro Borghi Filho commentedIf possible I would like more details on this one, I am getting a bit blocked.
I wrote this new patch with both the previous patch changes and a few more.
Any help for improving is welcome.
Kindly review.
Comment #12
Joel Guerreiro Borghi Filho commentedComment #13
dieterholvoet commentedYour patch is going to need a reroll since #3298588: Drupal Coding standards are not followed in project. was committed today. There's some overlap between that issue and this one.
The changes related to using
$this->entityTypeManagerseem okay.Here, you would override the
createmethod, assign thedatabaseservice to a new property and use that property instead of\Drupal::database().This is about checking whether we can make that method not static, make the class a service and inject it in the same way I described above. The
EntityInterface::loadcould then be replaced with$this->entityTypeManager->....Comment #14
jobsons commentedHi, it's my first reroll I hope it's ok. Here's the patch:
If someone could review it. Thanks :)
Comment #15
dieterholvoet commentedThat doesn't look right, you added the previous patch to the new patch as a .patch file. You can follow the instructions here.
Comment #16
jobsons commentedI could make the reroll of patch 12 without the previous patch being added :) If someone could please review it.
Comment #17
Joel Guerreiro Borghi Filho commentedReviewed patch from #16, it applies.
Removed reroll tag.
Changing to needs work.
Will try to work on #13 comment changes.
Comment #18
Joel Guerreiro Borghi Filho commentedComment #19
Joel Guerreiro Borghi Filho commentedI am not 100% sure this is correct, any tips are welcome for improving this.
Unassigning myself.
Will keep as needs work as it is not finished.
Comment #20
diegorsI´ll try to look on that
Comment #21
diegorsI found some bugs and made some changes, please review
Comment #22
gquisini commentedI'll be reviewing this one.
Comment #23
gquisini commentedI found and fixed some bugs.
Comment #24
lucasscComment #25
lucasscI applied the patch in #23 and verified that:
1) Searches didn't revel any occurrence of
EntityInterface::load()orEntityInterface::loadMultiple();2) No phpcs warnings like "\Drupal calls should be avoided in classes, use dependency injection instead" was found;
3) @diegors' patch in #21:
Here could the create method still be overridden as described in #13? See Dependency injection in Plugin (Block) and check the create method of the UserBlock's parent class (DashboardBlockBase).
Edit: I realized that in #19 @Joel Guerreiro Borghi Filho attached an interdiff that implements changes suggested in #13 but I couldn't find his patch.
Comment #26
sophiavs commentedi'll work on those errors
Comment #27
sophiavs commentedI did some changes that was reported in phpcs and removed the call of \Drupal::database.
The statics methods that i found was changed to non-statics calls.
Comment #28
sophiavs commentedComment #29
diegorsI'll review this.
Comment #30
diegorsFixed the remaining errors.
Please review.
Comment #31
sophiavs commentedI'll be reviewing
Comment #32
sophiavs commentedThe phpcs doesn't show any error and while testing the module everything goes fine. Passing to RTBC.
Comment #34
dieterholvoet commentedAny changes in
assets/distshould be reverted, that css is compiled and shouldn't be checked for CS issues. More improvements can be done, I started work on a MR which is still untested and WIP.Comment #36
dieterholvoet commented