With the introduction of annotated routes
#[Route(uriPattern: 'networks', httpMethods: ['GET'])]
public function indexAction()
{
$this->view->assignMultiple([
'networks' => $this->networks->findAll()
]);
}
#[Route(uriPattern: 'networks/{network}', httpMethods: ['GET'])]
public function showAction(?Network $network = null)
{
$this->view->assign('network', $network);
}
After configuring `Settings.yaml` (that part was something well hidden..!)
Neos:
Flow:
mvc:
routes:
Networkr.Application:
position: 'start'
providerFactory: Neos\Flow\Mvc\Routing\AttributeRoutesProviderFactory
providerOptions:
classNames:
- 'Networkr\Application\Controller\*Controller'
And the routes are present when running `routing:list` and `routing:show 1` ![]()
I can’t create a link from the Index.html fluid file to the show action
Code goes here
<h1>All networks</h1>
<ul>
<f:for each="{networks}" as="network">
<li>
{network.name}
<f:link.action action="show" arguments="{network : network}">Link</f:link.action>
</li>
</f:for>
</ul>
The error is as follow
26-04-07 09:34:17 34758 WARNING Neos.Flow Router resolve(): Could not resolve a route for building an URI for the given resolve context.
[array] =>
routeValues:
[array] =>
network:
[object] => [Networkr\Networkr\Domain\Model\Network]:
name:
[string] => abc
@action:
[string] => show
@controller:
[string] => network
@package:
[string] => networkr.application
If I move the Routes to the “good old” Configuration/Routes.yaml file
-
uriPattern: 'networks'
defaults:
'@package': 'Networkr.Application'
'@controller': 'Network'
'@action': 'index'
-
uriPattern: 'networks/{network}'
defaults:
'@package': 'Networkr.Application'
'@controller': 'Network'
'@action': 'show'
And Annotated routes deactivated, the link is generated just fine.
How come? What’s missing?