Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
migration system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Nov 2022 at 11:45 UTC
Updated:
15 Jul 2023 at 04:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeComment #3
mondrakeComment #4
mondrakeComment #5
longwaveAre EntityConfigBase and EntityContentBase the only two valid immediate child classes, and all users are expected to only extend them? If so we could make these abstract now?
Comment #6
smustgrave commentedShould this go back to NW for discovery?
Comment #7
mondrakeYes
Comment #8
mondrakeLet's try #5.
Comment #9
smustgrave commentedFree to review once it's done. If I don't get to it today just ping me on the #needs-review-queue channel and can take a look
Comment #10
mondrakeBetter luck?
Comment #11
smustgrave commentedChanges in #10 look good to me.
Comment #12
xjmI looked at where these two methods are used in core to confirm that these are correct additions.
EntityContentBase, which extends this class, has its own docblock forprocessStubRow(). It can now be replaced by{@inheritdoc}. (And yes, Symfony is dropping that, but we haven't adopted it ourselves so out of scope here to change the coding standard.) 🙂Similarly,
EntitySearchPage::updateEntity()has its own docblock that can be replaced by{@inheritdoc}.EntityRevisionTest::updateEntity()also has its own docblock, but in that case it's overriding the default behavior (and not calling the parent) so it's justified. However, that implementation's docblock does need the parameter and return docs added.It appears that the implementations return
$entity, and are expected to do so by callers. So, we should add that return value to the docs.The
EntityContentBaseimplementation also has a@throwsthat is missing here and may be relevant.The closing curly for this should be on the same line.
Thanks for working on this! It's great how many bugs PHPStan is finding in our APIs.
Comment #13
xjmSaving credits for the patch and substantive reviews.
Comment #14
mondrakeAddressed #12. Thanks!
Comment #15
spokje*cough*
PHPStan errors
*cough*
Comment #16
mondrakeYeah, ripple effect of doing #12.4 on a faltering API that was not enforcing typing across its implementations. Maybe #12.4 should not be done here. Anyway, here a patch.
Comment #17
mondrakeComment #18
smustgrave commentedAppears that changes requested in #12 have been addressed.
Comment #19
xjmThanks @mondrake. I think it's good to include #12.4 here, at least in 10.1.x. Maybe we should add a small change record for it, though.
It looks like the point about the
@throwsfrom #12.4 also hasn't been addressed yet, though. Thanks!Comment #20
xjmCome to think of it, this whole issue should get a CR.
Comment #21
mondrakeWhere? I cannot find it.
I do not understand what is changing here that requires a CR. Per #5, the classes that should be extended are EntityConfigBase and EntityContentBase, and they're not changing. If now someone is extending Entity directly without implementing updateEntity(), they would fail anyway.
Comment #22
xjmSorry, it was
EntityConfigBase:Re:
We are adding an API and changing a best practice. That gets a change record. It doesn't have to be a public BC break to get a change record.
Comment #23
smustgrave commentedFor the change record
Comment #25
spokjeRerolled 3318888-16.patch on 11.x in MR
Comment #27
spokjeAdded draft CR, definitly needs some eyes on that one.
Comment #28
smustgrave commentedCR looks good to me, especially since there is nothing for contrib to update.
Comment #30
longwaveThis is the definition of an abstract method, so there is probably no need to explicitly say it.
This is describing implementation details, which don't relate to this specific base class.
However, I don't think either of these should hold up commit, so let's just get this in. Committed and pushed 62d7c46774 to 11.x (10.2.x), and published the change record. Thanks!
Comment #31
spokjeFully agreed, but couldn't see how to address #12.4 and #22.1
Comment #34
quietone commentedClosed #2923683: \Drupal\migrate\Plugin\migrate\destination\Entity calls methods that are not required by subclasses as a duplicate, adding credit.