- Issue created by @erom
- Status changed to Postponed: needs info
3 months ago 10:29pm 21 August 2024
FileFieldItemList's postsave didn't check if entity->original is empty
When save an commerce invoice order inside state machine events subscriber cause the error:
Error: Call to a member function hasTranslation() on null in Drupal\file\Plugin\Field\FieldType\FileFieldItemList->postSave() (line 54 of \Drupal\file\Plugin\Field\FieldType\FileFieldItemList.php)
#0 [internal function]: Drupal\file\Plugin\Field\FieldType\FileFieldItemList->postSave(true)
#1 \Drupal\Core\Entity\ContentEntityStorageBase.php(938): call_user_func_array(Array, Array)
#2 \Drupal\Core\Entity\ContentEntityStorageBase.php(984): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('postSave', Object(Drupal\commerce_invoice\Entity\Invoice), true)
#3 \Drupal\Core\Entity\ContentEntityStorageBase.php(896): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldPostSave(Object(Drupal\commerce_invoice\Entity\Invoice), true)
#4 \Drupal\commerce\CommerceContentEntityStorage.php(56): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\commerce_invoice\Entity\Invoice))
#5 \Drupal\commerce_invoice\InvoiceStorage.php(25): Drupal\commerce\CommerceContentEntityStorage->invokeHook('update', Object(Drupal\commerce_invoice\Entity\Invoice))
#6 \Drupal\Core\Entity\EntityStorageBase.php(564): Drupal\commerce_invoice\InvoiceStorage->invokeHook('update', Object(Drupal\commerce_invoice\Entity\Invoice))
#7 \Drupal\Core\Entity\ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\commerce_invoice\Entity\Invoice), true)
#8 \Drupal\Core\Entity\EntityStorageBase.php(489): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\commerce_invoice\Entity\Invoice), true)
#9 \Drupal\Core\Entity\Sql\SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\commerce_invoice\Entity\Invoice))
#10 \Drupal\Core\Entity\EntityBase.php(354): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\commerce_invoice\Entity\Invoice))
#11 \Drupal\commerce_invoice\EventSubscriber\OrderPaidSubscriber.php(64): Drupal\Core\Entity\EntityBase->save()
#12 [internal function]: Drupal\commerce_invoice\EventSubscriber\OrderPaidSubscriber->onPaid(Object(Drupal\commerce_order\Event\OrderEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#13 \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\commerce_order\Event\OrderEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#14 \Drupal\commerce_order\OrderStorage.php(139): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\commerce_order\Event\OrderEvent), 'commerce_order....')
#15 \Drupal\commerce_order\OrderStorage.php(86): Drupal\commerce_order\OrderStorage->doOrderPreSave(Object(Drupal\commerce_order\Entity\Order))
#16 \Drupal\Core\Entity\EntityStorageBase.php(529): Drupal\commerce_order\OrderStorage->invokeHook('presave', Object(Drupal\commerce_order\Entity\Order))
#17 \Drupal\Core\Entity\ContentEntityStorageBase.php(753): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\commerce_order\Entity\Order))
#18 \Drupal\Core\Entity\EntityStorageBase.php(483): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\commerce_order\Entity\Order))
#19 \Drupal\Core\Entity\Sql\SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\commerce_order\Entity\Order))
#20 \Drupal\commerce_order\OrderStorage.php(169): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\commerce_order\Entity\Order))
#21 \Drupal\Core\Entity\EntityBase.php(354): Drupal\commerce_order\OrderStorage->save(Object(Drupal\commerce_order\Entity\Order))
#22 \Drupal\commerce_payment\PaymentOrderUpdater.php(104): Drupal\Core\Entity\EntityBase->save()
#23 \Drupal\commerce_payment\PaymentOrderUpdater.php(62): Drupal\commerce_payment\PaymentOrderUpdater->updateOrder(Object(Drupal\commerce_order\Entity\Order), true)
#24 \Drupal\commerce_payment\PaymentOrderUpdater.php(115): Drupal\commerce_payment\PaymentOrderUpdater->updateOrders()
#25 \Drupal\Core\DrupalKernel.php(723): Drupal\commerce_payment\PaymentOrderUpdater->destruct()
#26 \index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\TrustedRedirectResponse))
#27 {main}
Postponed: needs info
10.3 ✨