When trying to create an order as an admin, I'm getting this error:
The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Object of class Drupal\commerce_order\Entity\Order could not be converted to string in Drupal\Core\Entity\EntityStorageBase->buildCacheId() (line 131 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->buildCacheId(Object) (Line: 171)
Drupal\Core\Entity\EntityStorageBase->getFromStaticCache(Array) (Line: 269)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 250)
Drupal\Core\Entity\EntityStorageBase->load(Object) (Line: 531)
Drupal\Core\Entity\EntityBase::load(Object) (Line: 280)
Drupal\commerce_currency_resolver\CurrencyHelper->adminOrderRoutes() (Line: 265)
Drupal\commerce_currency_resolver\CurrencyHelper->isAdminOrder() (Line: 123)
Drupal\commerce_currency_resolver\CurrentCurrency->getCurrency() (Line: 76)
Drupal\commerce_currency_resolver\CurrencyOrderProcessor->process(Object) (Line: 156)
Drupal\commerce_order\OrderRefresh->refresh(Object) (Line: 127)
Drupal\commerce_order\OrderStorage->doOrderPreSave(Object) (Line: 108)
Drupal\commerce_order\OrderStorage->invokeHook('presave', Object) (Line: 492)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 692)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 446)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 838)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 394)
Drupal\Core\Entity\EntityBase->save() (Line: 165)
Drupal\commerce_order\Form\OrderForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder->processForm('commerce_order_default_edit_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm('commerce_order_default_edit_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Disabling the module gets it working.
I'm using Cookie as currency mapping, Combo Mode, and Fixer.io with two enabled currencies.
I've also disabled page_cache.
Comments
Comment #2
yassersammanComment #3
DeithsoThank you @Yasser Samman,
I'm facing the same issue, creating orders as admin, disabling the module fixed it,
Comment #4
daveianoI debugged this down to line 279 in CurrencyHelper.php:
getParameteralready returns the loaded order, not only the order id. The patch should fix this issue, but the module still leaks test coverage for creating an order via the admin ui.Comment #5
DeithsoHello @daveiano
I just digged into the bug and found the same thing, the order_id is already a loaded order object not the id as excpected so i made a little fix,
Waiting for an update
Comment #7
yassersammanComment #8
zaporylieMarking as fixed as it has been committed and pushed to 8.x-1.x