Router problems in zend framework

I've been stuck in this problem now for 3 days and don't understand why this code is producing this error

 'blogPost' => array(
                'type'   => `Segment`,
                `options`=> array(
                    'route' => `/blog/post[/:postId]`,
                    'defaults' => array(
                        'controller' => 'Rovers\Controller\Blog',
                        'action'     => 'post',
                    )
                )
            )   

error:

Fatal error: Uncaught exception 'Zend\Mvc\Router\Exception\InvalidArgumentException' with message 'Missing "type" option' in C:\web\main\myZend\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php on line 860

Zend\Mvc\Router\Exception\InvalidArgumentException: Missing "type" option in C:\web\main\myZend\vendor\zendframework\zendframework\library\Zend\Mvc\Router\SimpleRouteStack.php on line 269

Zend\ServiceManager\Exception\ServiceNotCreatedException: An exception was raised while creating "Router"; no instance returned in C:\web\main\myZend\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php on line 860

Upvotes: 0

Views: 2491

Answers (1)

Dennis
Dennis

Reputation: 8101

When getting this error, check:

  • does your configuration file contain "routes" and is it being loaded in the first place?
  • you sometimes may have child routes defined but not have the main route
  • do you have a 'type' in your route that is properly defined using single or double quotes ' or " and not any other similar-looking symbol

Upvotes: 1

Related Questions