On /admin/commerce/licenses I get this error:

Error: Call to a member function getStorage() on null in Drupal\commerce_license\Plugin\views\field\EntityLabel->preRender() (line 44 of modules\contrib\commerce_license\src\Plugin\views\field\EntityLabel.php).

Core changed Drupal\views\Plugin\views\field\EntityLabel and variable 'entityManager' is now called 'entityTypeManager'.

My patch fixes that.

Comments

dgDatpasst created an issue. See original summary.

brooke_heaton’s picture

This worked for me but resulted in a notice:

Notice: Undefined property: Drupal\commerce_license\Plugin\views\field\EntityLabel::$entityManager in Drupal\commerce_license\Plugin\views\field\EntityLabel->preRender()

dgDatpasst’s picture

@brooke_heaton this patch changes the property name to 'entityTypeManager' , so i guess your notice is an artifact from before patch installation.

joachim’s picture

Status: Active » Needs work

Thanks for the patch!

+++ b/src/Plugin/views/field/EntityLabel.php
@@ -41,7 +41,7 @@ class EntityLabel extends CoreEntityLabel {
-      $this->loadedReferencers[$type] = $this->entityManager->getStorage($type)->loadMultiple($ids);
+      $this->loadedReferencers[$type] = $this->entityTypeManager->getStorage($type)->loadMultiple($ids);

The problem with this change is that users running on versions of core older than 8.8 will get a similar error because they don't have $this->entityTypeManager.

We unfortunately need to put in if(isset()), and have both lines in to cover both cases.

sanduhrs’s picture

Status: Needs work » Needs review
StatusFileSize
new819 bytes

Patch is attached.

bewhy’s picture

Status: Needs review » Reviewed & tested by the community

applied patch from #5, works in 8.8

abu-zakham’s picture

I can confirm patch #5 fixed the issue.

heni_deepak’s picture

Thank you #sanduhrs
Patch #5 very clear solution. it's working awesome. :D

  • joachim committed f1128fd on 8.x-2.x authored by dgDatpasst
    Issue #3100029 by dgDatpasst, sanduhrs: Fixed license overview broken on...
joachim’s picture

Status: Reviewed & tested by the community » Fixed

Committed! Thanks everyone!

Status: Fixed » Closed (fixed)

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