[FLOW3-general] IdentityRoutePart does not match
Bastian Waidelich
bastian at typo3.org
Mon Aug 27 09:50:23 CEST 2012
Peter Rauber wrote:
Hi Peter,
> I am using a RestController and configured a subroute in my package for
> accessing article-resources:
> name: 'Mypackage Article Item'
> uriPattern: 'article/{article}'
> defaults:
> '@package': ' Mypackage'
> '@controller': 'Article'
> routeParts:
> article:
> objectType: ' Mypackage\Domain\Model\Article\Article'
> uriPattern: '{__identity}'
the last line doesn't look correct to me.
By default, the object route part uses "[...] the identity properties of
the specified model to generate the URI representation of the product.
If the model contains no identity, the technical identifier is used!
[...]" (see [1]).
So, if your model does not contain any @FLOW3\Identity annotations and
you want to use the UUID you won't have to specifiy the uriPattern.
> How can the ObjectPathMapping-table be filled? Do I have to write code to
> fill this table? Doesn't make sense to me.
The ObjectPathMapping table is filled whenever a new "object route" is
*resolved*. That means, whenever you render a URI.
That is required because otherwise URIs could be ambiguous (e.g. if the
uriPattern is not unique for every object).
In your case, however, you won't need the object route part handler as
far as I can see as the technical identifier (usually the UUID) is used
by default anyways. So this should do the trick:
name: 'Mypackage Article Item'
uriPattern: 'article/{article}'
defaults:
'@package': ' Mypackage'
'@controller': 'Article'
'@action': 'show'
[1]
http://flow3.typo3.org/documentation/guide/partiii/routing.html#object-route-parts
--
Bastian Waidelich
TYPO3 Core Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list