Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
content_translation.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2019 at 17:14 UTC
Updated:
18 Feb 2019 at 14:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedThis should do it. Not sure if such a minor thing deserves explicit test coverage though..
Comment #3
berdirThis came up before I believe, like in issues that tried to add proper methods for $entity->original and got stalled.
The thing is that it obviously doesn't ever go in there, as this would be a fatal error then. And $entity->original really should always be set. This might be some left-over cruft from 7.x when people did crazy things to just save single fields and so on.
So I'd suggest to just drop the whole part completely, *maybe* add a && $entity->original in the initial condition but I don't think we really bother with that in other hooks.
Comment #4
berdirComment #5
dhirendra.mishra commentedI will work on this in DrupalGlobalSprintWeekenddelhi2019
Comment #6
dhirendra.mishra commentedHere is the patch.
Comment #7
dhirendra.mishra commentedComment #8
joshi.rohit100This will not work as
->getStorage()requires string (entity type) as argument and in this case it will object.What I understand from the #3 is that we just need to add the condition && $entity->original at top like this -
if ($entity instanceof ContentEntityInterface && $entity->isTranslatable() && !$entity->isNew()) && $entity->original) {}Comment #9
dhirendra.mishra commentedHere is the updated comment.
Comment #10
amateescu commentedI looked around a bit and we do check
isset($entity->original)a few times, so let's do that here as well.Comment #11
berdirDoesn't make a difference as it goes through __get(), but we should get back to the issue about adding methods for that anyway.
Comment #13
catchCommitted 4a43a3b and pushed to 8.7.x. Thanks!