[Flow] SubRequests and Routes
Bastian Waidelich
bastian at typo3.org
Mon Oct 14 15:26:54 CEST 2013
Marc Neuhaus wrote:
Hi Marc,
> Currently they look quite scrambled [...]
> My aim would be more like
> http://standalone.flow/famelo.demo.admin/expose/new/index/Famelo/Demo/Admin/Domain/Model/Configurations
>
> http://standalone.flow/famelo.demo.admin/expose/Famelo/Demo/Admin/Domain/Model/Configurations/new/index
> [...] now how to make routes for SubRequests.
You should be able to target "sub-arguments" just as any other argument,
in your case s.th. like:
-
uriPattern:
'famelo.demo.admin/expose/{--exposeRuntime. at controller}/{--exposeRuntime. at index}/{--exposeRuntime.type}'
defaults:
'@package': '<Your.Package>'
'@controller': '<SomeController>'
'@format': 'html'
'sources': 'configuration'
'--exposeRuntime':
'@package': 'TYPO3.Expose'
'@format': 'html'
BUT....
> Or do i need to create a RoutePartHandler for this, because afaik, this
> is how Neos handles it.
....yes and no ;)
For Neos the case is a bit special because we need to take care of
context and workspace and such. Of course you could create a
RoutePartHandler that converts requests like
"new/index/Famelo/Demo/Admin/Domain/Model/Configurations" into the
respective RouteValues vice versa. But that wouldn't be very flexible.
You can go with the default RoutePart-handling *except* for the type:
In order to convert "famelo/demo/admin/dmain/model/configurations" into
"Famelo\Demo\Admin\Domain\Model\Configurations" you need a custom
RoutePartHandler, because the default RoutePartHandler only checks the
current URI segment.
The simplest implementation extends DynamicRoutePart and overrides
findValueToMatch() similar to the FrontendNodeRoutePartHandler from
Neos[1] to match the complete remaining requestPath.
Let me know if you need an example.
[1]
https://git.typo3.org/Packages/TYPO3.Neos.git/blob/HEAD:/Classes/TYPO3/Neos/Routing/FrontendNodeRoutePartHandler.php#l75
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the Flow
mailing list