Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Console controller cannot accept route with controller #3358

Closed
bakura10 opened this issue Jan 6, 2013 · 1 comment
Closed

Console controller cannot accept route with controller #3358

bakura10 opened this issue Jan 6, 2013 · 1 comment
Labels

Comments

@bakura10
Copy link
Contributor

bakura10 commented Jan 6, 2013

I have the following route in the console router:

'controller' => array(
                    'options' => array(
                        'route'    => 'ember create controller <controllerName>',
                        'defaults' => array(
                            'controller' => 'ZfrEmber\Controller\CodeGenerator',
                            'action'     => 'controller'
                        )
                    )
                ),

It says that i tCould not match a controller. However, changing the controller part in the route to something like 'ember create eController ' works. I suppose "controller" should not be a reserved keyword for routes.

weierophinney added a commit that referenced this issue Apr 4, 2013
Issue #3358 - Fix for console router not accepting controller word as part of a route
@ezk84
Copy link
Contributor

ezk84 commented Apr 23, 2013

This doesn't work because the Simple route will turn the controller literal (in your route definition) into a RouteMatch parameter with value true. This value will in turn override the default parameter value of 'ZfrEmber\Controller\CodeGenerator'.
In essence you will attempt to dispatch to a controller with service name true, which doesn't exist, hence the 'Could not match a controller` error message.

So as it stands, you cannot have a literal controller in your route definition and dispatch to an arbitrarily named controller. One way to resolve this could be (untested) to use a mandatory named alternative with one alternative in your route definition 'ember create (controller):altGroup <controllerName>'. That doesn't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants