My custom entity is revisionable, I can see revisions, but my revision revert form does not work. When I attempt to revert, I get the following error:
TypeError: Argument 3 passed to Drupalmsul_rovi_gamesFormRoviGameRevisionRevertForm::buildForm() must implement interface Drupalmsul_rovi_gamesEntityRoviGameInterface or be null, string given in Drupalmsul_rovi_gamesFormRoviGameRevisionRevertForm->buildForm() (line 116 of /opt/drupal/web/modules/custom/msul_rovi_games/src/Form/RoviGameRevisionRevertForm.php)
I am not sure why it is not upcasting. I am sure I am missing something obvious, but hours of searching have not led me to what I am missing.
What am I missing? Any insight into why it is not upcasting would be greatly appreciated!
Relevant portion of msul_rovi_games.routing.yml
entity.rovi_game.revision_revert_confirm: path: '/rovi_game/{rovi_game}/revisions/{rovi_game_revision}/revert' defaults: _title: 'Revert to an earlier revision' _form: 'Drupalmsul_rovi_gamesFormRoviGameRevisionRevertForm' requirements: _permission: 'administer rovi_game entities' rovi_game: d+ options: _node_operation_route: TRUE rovi_game: type: entity:rovi_game rovi_game_revision: type: entity_revision:rovi_game
Relevant portion of src/Form/RoviGameRevisionRevertForm.php
<?php namespace Drupalmsul_rovi_gamesForm; use DrupalComponentDatetimeTimeInterface; use DrupalCoreDatetimeDateFormatterInterface; use DrupalCoreEntityEntityRepositoryInterface; use DrupalCoreEntitySqlSqlContentEntityStorage; use DrupalCoreEntityEntityStorageInterface; use DrupalCoreFormConfirmFormBase; use DrupalCoreFormFormStateInterface; use DrupalCoreUrl; use Drupalmsul_rovi_gamesEntityRoviGameInterface; use SymfonyComponentDependencyInjectionContainerInterface; /** * Provides a form for reverting a rovi_game revision. * * @internal */ class RoviGameRevisionRevertForm extends ConfirmFormBase { /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, RoviGameInterface $rovi_game_revision = NULL) { $this->revision = $rovi_game_revision; $form = parent::buildForm($form, $form_state); return $form; } }