Closed (fixed)
Project:
Entity API
Version:
8.x-1.x-dev
Component:
Code - misc
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Apr 2020 at 08:07 UTC
Updated:
3 Jan 2022 at 06:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
swatichouhan012 commentedKindly review patch.
Comment #3
sanjayk commentedComment #4
sanjayk commentedI have reviewed above patch and it's working fine but still need to replace t() with $this->t() in some files. I have created a patch for that.
Comment #5
berdirthis is not a class.
Comment #6
deepak goyal commentedComment #7
deepak goyal commentedHi, @Berdir
Updated patch please review.
Comment #8
Pooja Ganjage commentedHi,
I am applying patch with using \Drupal\Core\StringTranslation\StringTranslationTrait class.
Please review once.
Comment #9
Pooja Ganjage commentedComment #10
berdirThe patch doesn't apply.
this seems to add an extra empty line with spaces.
here too.
changes to this class seem to be unecessary/out of scope, it already has the StringTranslationTrait from the parent class.
Injecting the service is optional and core isn't doing it most of the time, the trait offers a setter that could be used for unit testing if really necessary.
Comment #11
sanjayk commentedComment #12
Pooja Ganjage commentedHi,
Attached updated patch.
Kindly review this patch once.
Thanks.
Comment #13
Pooja Ganjage commentedComment #14
sanjayk commented@Pooja Ganjage have same issues "No such file or directory" in both #8 and #12 please fixed it.
Comment #15
Pooja Ganjage commentedHi,
Attached updated patch.
Kindly review once.
Let me know for any correction.
Thanks.
Comment #16
Pooja Ganjage commentedNeeds Review
Comment #17
sanjayk commented@Pooja still two files are not found please follow the instruction here under "More Git Commands" https://www.drupal.org/node/707484 and add files in patch.
Comment #18
sanjayk commentedUploading correct patch.
Comment #20
sanjayk commentedSorry by mistake uploaded wrong patch
Comment #21
sanjayk commented@Berdir by mistake added test for D9.1 but test cases pass for D8.
Comment #22
sanjayk commentedPlease ignore #21 attached interdiff.
Comment #23
sanjayk commentedComment #24
tr commentedThis is getting further and further away from where it should be.
Both EntityViewsData and ConfirmFormBase already have StringTranslationTrait, so that is inherited by the Entity classes. All you have to do is use $this->t() instead of t().
The patch in #2 is essentially correct. There may be a few other places that should use $this->t(), but subsequent patches added out-of-scope changes and shadowed properties and methods by overriding the inherited properties and methods of the parent classes. You can inject string_translation or not (it's not technically wrong but there's really no reason to do it), however you shouldn't be shadowing the parent properties and methods. @Berdir already said this in #10.
Comment #25
anagomes commentedComment #26
anagomes commentedI'm uploading a patch based on the one in #2, with some small changes, which I believe are in the scope of this issue and solves the problem. Running phpcs, there are no warnings about this matter anyway.
Comment #28
anagomes commentedUploading a new patch with small corrections, since the last one didn't pass the tests.
Comment #30
tr commentedNote that the Entity API currently has 14 failing tests - any patch you submit will be "Waiting for branch to pass" until you click through and select "Don't wait". I have done that now to get your patch tested.
Best case, you should have 14 failing tests.
The patch looks pretty good to me. Let's see what happens with the tests.
Comment #32
tr commentedCore Entity API tests have now been fixed. I retested the patch in #28 and as you can see there are no problems with it.
Committed #28. Thanks for working on this.