Sara Fuerst
Sara Fuerst

Reputation: 6068

Zend Framework Routing Issue

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?

Upvotes: 0

Views: 41

Answers (1)

sowa
sowa

Reputation: 1329

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

'router' => array(
    'routes' => array(
        'blinqc' => array(

Upvotes: 1

Related Questions