Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
quickedit.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Apr 2019 at 06:13 UTC
Updated:
4 Jul 2019 at 20:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mxr576Comment #3
mxr576Comment #4
mxr576Comment #5
amateescu commentedThese changes are not necessary because
ContentEntityInterfaceextendsRevisionableInterface, so let's remove them from the patch.The other two changes look good :)
Comment #6
mxr576Thanks for the review @amateescu.
I think both are important because both functions should support all revisionable entity types - not just content entities. Developers who are modifying the body of this function should not expect that $entity implements the ContentEntityInterface. They should expect what it is in the parameter type hint, EntityInterface, and if the object also implements the RevisionableInterface then they can also call methods defined by that interface.
So as a conclusion I have removed the extra type-hint from quickedit_entity_view_alter().
Comment #7
mxr576Meh :)
Comment #8
amateescu commentedYup, I agree that we need the changes in
quickedit_preprocess_field()andquickedit_entity_view_alter, but #5 was about rolling back the changes to_quickedit_entity_is_latest_revision():)Comment #9
mxr576I got it but I think that function should not type-hint to ContentEntityInterface either because of the above-mentioned reasons. It should type-hint to the less specific interface.
Comment #10
amateescu commentedOk then, let's do it.
Comment #11
catchDoes this need test coverage? If it's just clean-up/theoretical I think it's OK without, but if it's causing an error we'd be missing coverage.
Comment #12
amateescu commentedThe problem could only happen for an entity type that implements
RevisionableInterfacebut notContentEntityInterface, and we don't have any example of that in core, not even in a test entity type. Not sure if that makes it theoretical or not.. :)Comment #13
mxr576#12 +1
Although, considering the long term run, Drupal core should have its own test entities later are only fieldable, or only revisionable, or both, but not content entities :)
Comment #14
mxr576I have an example for that in a contrib module that creates 1rst citizen Drupal entities from REST API responses. I am planning to write a blog post about our journey and all the challenges that we faced when we tried to build entities in Drupal 8 that are not content- or config entities. There were plenty... :) So I do not want to spoil anything by sharing its code here.
Can we get this merged?
Comment #15
mxr576Comment #16
larowlanComment #17
yogeshmpawarComment #18
yogeshmpawarRerolled the patch against 8.7.x branch.
Comment #19
wim leersPer the RTBC from @amateescu in #10, and the un-RTBC by @catch in #11 which was answered by @amateescu in #12, re-RTBC'ing.
Comment #21
catchCommitted/pushed to 8.8.x and 8.7.x, thanks!