Spawning an issue from
#2226533: Changes to the Language class due to the LanguageInterface (followup)
it would be nice to hive off all the changes such as
- $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id;
+ $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
into a separate issue... to make the review process a breeze
Well this is it..
| Comment | File | Size | Author |
|---|---|---|---|
| #40 | 2340667.40.patch | 197.39 KB | yesct |
| #38 | 2340667.38.patch | 197.38 KB | yesct |
| #35 | interdiff.2340667.34.35.txt | 1.64 KB | yesct |
| #35 | 2340667.35.patch | 197.29 KB | yesct |
| #34 | interdiff.2340667.33.34.txt | 510 bytes | yesct |
Comments
Comment #1
martin107 commentedAfter about 70mins of work on this .. I have made so many changes that I need to see if I have made any gross mistakes before continuing.
Please don't consider this ready for review....just for testbot inspection.
My sense is that I have almost stripped out all but the wanted changes ( My starting point was 2226533.291.patch see parent)
When I said it would be a breeze to review... err well it is still going to be a >200Kb monster :)
Comment #3
martin107 commentedPatched up the most frequently recurring bugs
Still expect problems...
Comment #5
martin107 commentedThis patch is so large it will need a daily reroll... ( It needs a reroll now )
It seems appropriate to postpone until the other issue spawned skrink the parent issue down a bit
Comment #6
alexpottI'm not sure I agree about postponing this issue - it certainly does not need to go in before the beta but it actually easy to reroll since the correct thing to do with be always to accept the changes from HEAD and redo the fixes - which is exactly what did not occur earlier so other changes got partially reverted in the patches.
Comment #8
yesct commentedI'm ok with rerolling this frequently.
I agree we should resolve the conflicts usually by keeping what is in head, and then doing what the patch is intending... usually changing ->id to ->getId() ... etc.
Comment #9
alexpottFixed test fails.
Comment #10
martin107 commentedI have taken a slow and steady visual scan of this patch ... in short everything looks appropriate, with a few exceptions.
I have found a few mis filtered ( by myself, I suspect ) changes that are technically out of scope ... but they are so small I don't propose we go to the effort of removing what are after all improvements..
the first one is also part of a sister patch to pick out annotation improvements.
Comment #11
alexpottLeft #10.1 in since it related to this patch as we're using this method on the array elements returned by this patch. Removed #10.2 since yep it is unrelated change.
Rerolled.
Comment #12
martin107 commentedComment #13
Pedro Lozano commentedReroll.
Comment #15
Pedro Lozano commentedTrying to fix all those ->id references.
Comment #16
martin107 commentedHi Pedro, just looking at the change in patch size .... down 85% .. did another issue make most of the changes redundant?
Comment #17
alexpottNope and the id properties are no longer protected... perhaps the patches should be combined.
Comment #18
Pedro Lozano commentedSorry for the screw up guys, it is my first patch work in a long time.
This should be the complete patch.
Comment #20
Pedro Lozano commentedFixing more instances of ->id.
Comment #22
Pedro Lozano commentedComment #23
dawehnerIt is odd that we have
->id()on entities and->getId()here, quite confusing actually.This bit should be directly at least described in the IS ...
This will have a small conflict with #2070737: Change values of LanguageInterface::DIRECTION_(LTR/RTL) to ('ltr'/'rtl'). Just to keep in mind, maybe.
Much better if you ask me. Just as a general tip (not a review) you can use
->willReturnValue($language));This safes a little bit of typing which is really nice.What happened with the name? Should we just try to move this over?
Comment #24
Pedro Lozano commented@dawehner Since I'm not the original author of the patch I can't comment much on the issues you pointed out.
IMHO
1. Yes, I'm also confused about it. And one implementation of getId() is return $this->id() and the other one is return $this->id.
2. I just rerolled and got no conflict on that part. But got a conflict about the change from ContentEntityInterface to FieldableEntityInterface, that I solved in favor of FieldableEntityInterface.
Uploading just a reroll.
Comment #25
martin107 commentedI agree the ->id() or -> getId() is horribly inconsistent - Please not that I am not expressing an opinion one way or the other on which I prefer.
I want to speak neutrally, and just detail some facts in order to aid a more informed discussion, and prevent a bike shed moment.
I think we should fall in line with the entity way of doing things, for a greatest consistency.
I have included a link to just an entity discussion and and note it is an active issue. That debate is not new. - others may comment that we are we are in beta now and the way forward is settled.
Comment #26
dawehnerYeah, so what should we do here. D8MI people?
Comment #27
yesct commentedrenaming getId() to id() is a separate issue. and the opposite of .. #2246695: replace all core usages of id() with getid()
@tstoeckler suggested adding getId() to EntityBase and EntityInterface and marking id() deprecated. Anyway.. not the problem of this issue.
Comment #28
yesct commentedI rerolled the one from 11 to check the one from 24, which also needed a reroll.
The results were different. So I'm doing it again. (right now.)
patch coming in a bit.
Comment #29
yesct commentedone of the issues conflicting with this was #2341927: Language module annotation improvements [ plus minor followup ]
I'm not sure if we want it to be getId() ... guess can see if there are any fails.
$this->langcodes[$i] = $language->id();
anyway.
attached is the reroll of 11, and of 24.
and an interdiff of those.
for example,
- $this->assertTrue($this->entity->language()->getID() == 'en');
+ $this->assertTrue($this->entity->language()->getId() == 'en');
I think we should go with the reroll of 11. ... guess we should see what the testbot says.
Comment #31
yesct commentedI missed one.
This should pass.
oh, of course it needs a reroll. ... for ... #2123867: Simplify/cleanup language handling in EntityFormController
looks like those hunks just went away.
Comment #32
yesct commentedI will reroll this now.
Comment #33
yesct commentedautomatic 3-way merge. no conflicts.
Comment #34
yesct commentedok. *deep breath*
making id protected on ConfigurableLanguage also. Let's see how this does.
Comment #35
yesct commentedcool green again.
I read through all the lines of this patch.
Most are straight forward ->id to ->getId()
some are changes in the test that were setting id, and so have been reworked around doing that.
while reading I found one ->name to ->getName() that snuck in. I took that out.
And since starting all this a long time ago, I have noticed #2305593: [policy] Set a standard for @var inline variable type declarations so have fixed the change here to be better for more IDEs.
I think this is ready.
For a reviewer, try using the git --color-words in your diff to make reviewing easier.
Comment #36
yesct commentedI think we could actually get this done. putting on the sprint board for d8mi.
Comment #37
yesct commentedI am rerolling this now.
Comment #38
yesct commentedconflicts were from
a context line removed in #2350915: Don't require bundle option to be passed in when creating a MenuLinkContent entity
a context line changed in #2347465: Convert all instances of #type link/links to convert to use routes
context lines changed in #2070737: Change values of LanguageInterface::DIRECTION_(LTR/RTL) to ('ltr'/'rtl')
no tricky things.
Comment #40
yesct commentedoops. I missed a conflict.
fixed.
$node did not know what kind of thing it is, so I told it with a @var.
Comment #41
vijaycs85Looks like we missed the name while converting. Except that, +1 to RTBC.
The changes spread across all over the core. Would be great to get it in in before any other issues to avoid merge conflicts and reroll pains.
Comment #42
yesct commentedwell, name is being done in #2341341: Change public 'name' property access on languages to getName() and add back setName()
ah, in this hunk in PathProcessorTest
Yeah, when we converted this test instead of making a new object and then setting the id and name, to: passing the needed info in the constructor.. that name was not needed at all. So that is why the line is taken out and a corresponding line not added back. [edit] So I think this is an ok change here.
Comment #43
vijaycs85Alright. let's get this in.
Comment #44
martin107 commentedMinor point regarding my comments from #25, given where we are today ... I am now convinced that this is the best way forward.
Just didn't want to hold up the review process.
Comment #45
alexpottThe test assertion message here is less useful to a developer than the default - which would tell you what the two langcodes are.
This is not a real mock :) Since we don't actually mock any functions might as well just create a language object. If we want to use mocks then we should mock the interface and the getId() method. However this is out-of-scope for this change and should be dealt with in a new issue.
Neither of the two above issues should hold up this change - let's get this done.
Comment #46
catchCommitted/pushed to 8.0.x, thanks!
Comment #48
yesct commentedwow! thanks so much everyone!
--
opened issues for things noticed in #45
#2355543: TokenTest Language mock is not accurate
#2355545: UserInstallTest testUserInstall() custom assert message not more helpful than the default.
Comment #49
gábor hojtsyThanks!