My custom entity is revisionable. I can see revisions, but my revision revert form doesn't work. The route for the form is definited in 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: '\Drupal\msul_rovi_games\Form\RoviGameRevisionRevertForm'
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
The form is defined in src/Form/RoviGameRevisionRevertForm.php.
namespace Drupal\msul_rovi_games\Form;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\msul_rovi_games\Entity\RoviGameInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* 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;
}
}
When I attempt to revert, I get the following error.
TypeError: Argument 3 passed to Drupal\msul_rovi_games\Form\RoviGameRevisionRevertForm::buildForm() must implement interface Drupal\msul_rovi_games\Entity\RoviGameInterface or be null, string given in Drupal\msul_rovi_games\Form\RoviGameRevisionRevertForm->buildForm() (line 116 of /opt/drupal/web/modules/custom/msul_rovi_games/src/Form/RoviGameRevisionRevertForm.php)
What am I missing?