Using this route:

  path: '/node/{node}/submission/{webform_submission}/confirm'
    _controller: '\Drupal\mymodule\Controller\MymoduleController::confirm'
    _title: 'Confirm your submission'
    _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:


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) {


    $response = new Response( 'test' );

    return $response;

1 Answer 1


You probably just need to declare the parameter type:

  path: '/node/{node}/submission/{webform_submission}/confirm'
    _controller: '\Drupal\mymodule\Controller\MymoduleController::confirm'
    _title: 'Confirm your submission'
    _permission: 'confirm webform submission'
        type: entity:webform_submission

The parameter names also need to match, so update your controller accordingly:

public function confirm(EntityInterface $node = null, EntityInterface $webform_submission = null) {
  • doesnt work unfortunately, the 2nd parameter is always NULL. if i look in how webform handles it itself (WebformSubmissionViewController::view) i wonder if this is even possible. should be though, since its a regular entity, isnt it?
    – Alex
    Jan 11, 2019 at 12:05
  • ive updated my code.
    – Alex
    Jan 11, 2019 at 12:15
  • You should also set the type hint the entity type interface. confirm(NodeInterface $node = NULL, WebformSubmissionInterface $submission = NULL)
    – jrockowitz
    Jan 11, 2019 at 12:18
  • @jrockowitz i had like that initially, but it doesnt work either. i switched to entityinterface bc thats how webform does it itself. thanks though
    – Alex
    Jan 11, 2019 at 12:20
  • 1
    Symfony is sensitive to the parameter name @Alex - make sure it’s the same in the routing file and the controller.
    – Clive
    Jan 11, 2019 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.