I am trying to create a URL to an unprefixed controller from a template that is used for a prefixed route. The following code causes an error “Missing Route”, even though ['controller' => 'Authors', 'action' => 'search']
is defined.
$this->Url->build([
'prefix' => '',
'controller' => 'Authors',
'action' => 'search'
])
If I set prefix
to null
or remove it entirely, I get a prefixed URL (/admin/authors/search
).
This is the context of the route/template i am calling it from:
[
'_scheme' => 'http',
'_host' => 'localhost',
'_port' => (int) 3000,
'_base' => '',
'params' => [
'pass' => [ ],
'controller' => 'Articles',
'action' => 'add',
'prefix' => 'Admin',
'plugin' => null,
'_matchedRoute' => '/admin/articles/add',
'_ext' => null,
],
]