When configuring default image on a field and viewing the configuration page, the follow error is thrown.

Error: Call to undefined method Drupal\Core\Entity\EntityTypeManager::loadEntityByUuid() in Drupal\svg_image_field\Plugin\Field\FieldType\SvgImageFieldItem->defaultImageForm() (line 238 of modules/contrib/svg_image_field/src/Plugin/Field/FieldType/SvgImageFieldItem.php).

loadEntityByUuid() is not found on EntityTypeManager, instead its a method on EntityManager

See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

Comments

jasonawant created an issue. See original summary.

jasonawant’s picture

Assigned: jasonawant » Unassigned
Status: Active » Needs review
StatusFileSize
new569 bytes

Here's a patch.

carsteng’s picture

Bug confirmed...
EntityManager is marked as deprecicated.

Another solution would be:

 if ($uuid && ($file = $this->getEntityManager()->getStorage('file')->loadByProperties(['uuid' => $uuid]))) {
      $file = reset($file);
      $fids[0] = $file->id();
 }
dunot’s picture

Assigned: Unassigned » dunot

  • dunot committed 4905b49 on 8.x-1.x
    Issue #2960985 by carstenG: Fix Error: Call to undefined method Drupal\...
dunot’s picture

Status: Needs review » Fixed
jasonawant’s picture

Hi dunot, thanks for committing!

Could you change the commit message to give me authorship and thus issue credit? I would really appreciate it!

See the following the links. Thanks, Jason.

dunot’s picture

jasonawant, carstenG said right that
> EntityManager is marked as deprecicated
and I don't know how to change commit
that already is in remote repo.
And even if we can do it,
it would be bad consequences
for the module have been cloned.

Status: Fixed » Closed (fixed)

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