Skip to content

Generate content entity: Revision links broken #4317

@ghost

Description

Generate content entity: Revision links broken

[ ISSUE-GROUP ]

  • generate:entity:content
  • template

Problem/Motivation

Visiting revision page for generated entity at admin/structure/{entity_type}/{entity_id}/revisions results in the following error:

The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\movie_academy_director\Entity\Director::link() in Drupal\movie_academy_director\Controller\DirectorController->revisionOverview() (line 127 of /home/alexanderverbruggen/Repositories/gitlab.hosted-tools.com/movie_academy/htdocs/lib/modules/custom/movie_academy_director/src/Controller/DirectorController.php).

Drupal\movie_academy_director\Controller\DirectorController->revisionOverview(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
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: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

How to reproduce

  • drupal generate:entity:content (make it revisionable)
  • create an entity
  • visit admin/structure/{entity_type}/{entity_id}/revisions

Solution

Use Link class and entity link function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions