Error after upgrading to the latest version

Created on 11 May 2023, about 1 year ago
Updated 16 May 2023, about 1 year ago

Problem/Motivation

Hello,

After upgrading to the latest version of module (1.5.10), when we try to install new site using acquia_cms_image module, we get this error message:
[error] Error: Call to a member function getSource() on null in Drupal\media\Entity\Media->getSource() (line 137 of /var/www/html/docroot/core/modules/media/src/Entity/Media.php) #0 /var/www
/html/docroot/core/modules/media/src/Entity/Media.php(427): Drupal\media\Entity\Media->getSource()
#1 /var/www/html/docroot/core/modules/media/src/MediaStorage.php(27): Drupal\media\Entity\Media->prepareSave()
#2 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\media\MediaStorage->save()
#3 /var/www/html/docroot/modules/contrib/acquia_cms_image/acquia_cms_image.install(58): Drupal\Core\Entity\EntityBase->save()
#4 [internal function]: acquia_cms_image_install()

Steps to reproduce

Do a clean install of a project including the module acquia_cms_image module.

Proposed resolution

I think that the problem is related to this new code in the hook_install
$acquia_cms_logo = Media::create([
'name' => 'Acquia CMS Logo',
'bundle' => 'image',
'uuid' => '0c6f0f26-9fbb-4c2e-804c-418815aba162',
'image' => [
'target_id' => $image->id(),
'alt' => t('Acquia CMS logo'),
'title' => t('Acquia CMS logo'),
],
'langcode' => 'en',
]);
$acquia_cms_logo->save();
I think the image media type is not yet created to be able de create a new media.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.5

Component

Code

Created by

🇫🇷France aamouri

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024