0

I have a module with the following in the module.config.php

<?php
return array(
        'controllers' => array(
                'invokables' => array(
                        'BlindQC\Controller\BlindQC' => 'BlindQC\Controller\BlindQCController',
                ),
        ),
        // The following section is new and should be added to your file
        'router' => array(
                'routes' => array(
                        'blinqc' => array(
                                'type' => 'Segment',
                                'options' => array(
                                        'route' => '/blindqc/jobs[/:user_id]',
                                        'defaults' => array(
                                                '__NAMESPACE__' => 'BlindQC\Controller',
                                                'controller' => 'BlindQC',
                                                'action' => 'index',
                                        ),
                                ),
                        ),
                ),
        ),
        'view_manager' => array(
                'template_path_stack' => array(
                        'blindqc' => __DIR__ . '/../view',
                ),
        ),
);

This allows me to go to www.example.com/blindqc/jobs or www.example.com/blindqc/jobs/123456

On this page I have a search box where the user can enter a user_id, which upon hitting Search should redirect them to the url followed by the entered user_id. So if they type 999999 it should take them to www.example.com/blindqc/jobs/999999. I seem to be having an issue using routes to get them there.

I've tried:

return $this->redirect()->toRoute("blindqc/jobs/", array("user_id" => $userId)); 

But I get an error:

Route with name "blindqc" not found

What am I doing incorrectly? As far as I can tell the route is defined correctly?

1 Answer 1

1

The third line in the snippet below reads blinqc whereas it ought to be blindqc.

'router' => array(
    'routes' => array(
        'blinqc' => array(
Sign up to request clarification or add additional context in comments.

1 Comment

I can't believe I didn't notice that -_-. Thank you!

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.