Using this route:
confirm:
path: '/node/{node}/submission/{webform_submission}/confirm'
defaults:
_controller: '\Drupal\mymodule\Controller\MymoduleController::confirm'
_title: 'Confirm your submission'
requirements:
_permission: 'confirm webform submission'
And visiting node/15/submission/15/confirm
I get the error:
RuntimeException: Controller "Drupal\mymodule\Controller\MymoduleController::confirm()" requires that you provide a value for the "$submission" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. in Symfony\Component\HttpKernel\Controller\ArgumentResolver->getArguments()
What am I doing wrong? Why doesnt it load the submission 15? It does exist.
Edit: this is my Controller, the second argument is always null:
<?php
namespace Drupal\mymodule\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\Controller\EntityViewController;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Entity\EntityInterface;
use Drupal\webform\WebformSubmissionInterface;
use Drupal\webform\WebformSubmission;
/**
* @todo
*/
// class MymoduleController extends ControllerBase { // doesnt make a difference
class MymoduleController extends EntityViewController {
public function confirm(EntityInterface $node = null, EntityInterface $submission = null) {
debug($submission);
$response = new Response( 'test' );
return $response;
}
}