I have been burned, repeatedly, by presuming something about the langcode of getEntity both from above and from below. Documenting this is easy and the recommended method calls cheap.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Charlie ChX Negyesi created an issue. See original summary.

Ghost of Drupal Past’s picture

amateescu’s picture

I think we should start with something like "If the entity is translatable and..". And the "not reliable" part could be changed to sound a bit 'better' :) How about this:

   *   The wrapped entity object. If the entity is translatable and a specific
   *   translation is required, always request it by calling ::getTranslation()
   *   or ::getUntranslated() as the language of the returned object is not
   *   defined.
Ghost of Drupal Past’s picture

FileSize
1.58 KB

Thanks for the review.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Anytime :)

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4b43257 and pushed to 8.8.x. Thanks!

  • catch committed 4b43257 on 8.8.x
    Issue #3065609 by Charlie ChX Negyesi: Document translations vs...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.