editing a ticket throws: Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::getTransitions() in Drupal\state_machine\Access\StateTransitionAccessCheck->access() (line 51 of modules/contrib/state_machine/src/Acces

Created on 5 March 2024, over 1 year ago

Problem/Motivation

Visiting /admin/commerce/tickets and selecting the 'Edit' operation for a ticket throws the error below:

Steps to reproduce

1 - clean install and current patches
2 - complete a transaction
3 - visit /admin/commerce/tickets and selecting the 'Edit' operation

Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::getTransitions() in Drupal\state_machine\Access\StateTransitionAccessCheck->access() (line 51 of modules/contrib/state_machine/src/Access/StateTransitionAccessCheck.php).

call_user_func_array(Array, Array) (Line: 160)
Drupal\Core\Access\AccessManager->performCheck('access_check.state_transition', Object) (Line: 136)
Drupal\Core\Access\AccessManager->check(Object, Object, Object, 1) (Line: 113)
Drupal\Core\Access\AccessManager->checkRequest(Object, Object, 1) (Line: 107)
Drupal\Core\Routing\AccessAwareRouter->checkAccess(Object) (Line: 92)
Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 226)
Drupal\system\PathBasedBreadcrumbBuilder->getRequestForPath('/admin/commerce/orders/13/tickets/3', Array) (Line: 172)
Drupal\system\PathBasedBreadcrumbBuilder->build(Object) (Line: 83)
Drupal\Core\Breadcrumb\BreadcrumbManager->build(Object) (Line: 73)
Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback('Drupal\block\BlockViewBuilder::preRender', Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 β†’ ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 858)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'Drupal\block\BlockViewBuilder::preRender', Array) (Line: 421)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 493)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 43)
__TwigTemplate_f53fc9c56ac30ce36a67cee4c8ec450f->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/page.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 86)
__TwigTemplate_07edeba26fbe067e710b2fc387c485dd->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/classy/layout/html.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom martin@manarock.co.uk

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

Comments & Activities

  • Issue created by @martin@manarock.co.uk
  • πŸ‡¬πŸ‡§United Kingdom martin@manarock.co.uk

    Note this with a D10 install (3382034), and ready patched with 341685, 3415783, 3425570.

  • πŸ‡³πŸ‡ΏNew Zealand davidwhthomas

    This appears to happen because the ticket edit route conflicts with the commerce_order state-transition-form, or vice versa.

    Drupal\commerce_order\Entity\Order.php
    "state-transition-form" = "/admin/commerce/orders/{commerce_order}/{field_name}/{transition_id}"
    
    Drupal\commerce_ticketing\Entity\CommerceTicket.php
    "edit-form" = "/admin/commerce/orders/{commerce_order}/tickets/{commerce_ticket}/edit"

    So the edit form is processed via the state_maching transform form access check.

  • πŸ‡³πŸ‡ΏNew Zealand davidwhthomas
  • πŸ‡ΊπŸ‡ΈUnited States bogdog400

    Yes, I'm seeing essentially the same error. I'm just adding this in case it helps.

    
    
    Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::getTransitions() in Drupal\state_machine\Access\StateTransitionAccessCheck->access() (line 51 of modules/contrib/state_machine/src/Access/StateTransitionAccessCheck.php).
    Drupal\state_machine\Access\StateTransitionAccessCheck->access()
    call_user_func_array() (Line: 160)
    Drupal\Core\Access\AccessManager->performCheck() (Line: 136)
    Drupal\Core\Access\AccessManager->check() (Line: 113)
    Drupal\Core\Access\AccessManager->checkRequest() (Line: 110)
    Drupal\Core\Routing\AccessAwareRouter->checkAccess() (Line: 95)
    Drupal\Core\Routing\AccessAwareRouter->matchRequest() (Line: 225)
    Drupal\system\PathBasedBreadcrumbBuilder->getRequestForPath() (Line: 171)
    Drupal\system\PathBasedBreadcrumbBuilder->build() (Line: 83)
    Drupal\Core\Breadcrumb\BreadcrumbManager->build() (Line: 72)
    Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 171)
    Drupal\block\BlockViewBuilder::preRender()
    call_user_func_array() (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 788)
    Drupal\Core\Render\Renderer->doCallback() (Line: 374)
    Drupal\Core\Render\Renderer->doRender() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 43)
    __TwigTemplate_68a0a88db1848b1b290b0eeffdae2a75->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 86)
    __TwigTemplate_bd2763cc78037ec013753a462d2694d4->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 162)
    Drupal\Core\Render\MainContent\HtmlRenderer->{closure:Drupal\Core\Render\MainContent\HtmlRenderer::renderResponse():157}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 157)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    call_user_func() (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
    
Production build 0.71.5 2024