Feature #37405

When changing a property wich is used in routing the Link-VH should direkt to the new properties value

Added by Johannes Steu about 3 years ago. Updated 9 months ago.

Status:Under Review Start date:2012-05-22
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:MVC - Routing
Target version:-
PHP Version: Complexity:
Has patch:No

Description

When updating a models property wich is used in routing the Link.action-ViewHelper directs to the old properties value.
The new Route with new values does work when typing in manually as the old one does.

The Documentation about Routing says:
"Mappings from an object to it’s URI representation are stored in the ObjectPathMappingRepository in order to make sure, that existing links work even after a property has changed."

When using properties for routing they should be the mainly the value i set them.
So i think the Link.Action-ViewHelper should direct to the new route automatically instead to the old one. The old route should still be working to make sure, that for example bookmarked links work even after updating the property.


Related issues

related to TYPO3.Flow - Feature #29972: Configurable Redirects Under Review 2011-09-18

History

#1 Updated by Aske Ertmann about 3 years ago

The problem is that the identity route part's resolveValue method only check for the object identity and doesn't take into account if the property value is actually the same.

http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git?a=blob;f=Classes/Mvc/Routing/IdentityRoutePart.php;h=fdf977d32ef19c1af69d61212c150500580bfcdd;hb=HEAD#l169

A fix could be to always create the pathsegment from the object, and then check if the stored pathsegment matches to created one. One problem is the uniquePathSegment which loop and adds a number until it finds one that isn't used, but that could be solved by adding that do the database row and if it's > 0 then add it when matching the created one.

It could have some performance issues though, but it seems a better solution than having to remove the entry from the database so the old one wouldn't work anymore.

#2 Updated by Bastian Waidelich about 3 years ago

  • Status changed from New to Needs Feedback

Hi Johannes,

currently it works like RealURL (for example):
Let's say you have an uriPattern products/{product} and the title of the product is annotated with the identity annotation (or you've set the uriPattern of the object to "{product.title}").
The resulting URI would look like http://localhost/products/my-product
If you rename the product to "new name" the URI will still be the same, until you remove the ObjectPathMapping record (for now there is no corresponding command, so you need to do that "manually").

If I got you right, you suggest to create links pointing to http://localhost/products/new-name while keeping the old URI working. But that would lead to Duplicate Content

The right way to do this would be a redirect from "/my-product" to "/new-name" and that feature is planned (see #29972) - unfortunately not before 1.2.
If that would solve your issue, I'd like to close this issue

#3 Updated by Johannes Steu about 3 years ago

Hello Bastian,

if a redirect is planned this should be exactly that what i thought about!
So it's fine with me to close this issue!

#4 Updated by Gerrit Code Review about 3 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11552

#5 Updated by Karsten Dambekalns about 3 years ago

  • Assigned To set to Aske Ertmann

#6 Updated by Karsten Dambekalns about 3 years ago

  • Target version set to 2.0 beta 1

#7 Updated by Karsten Dambekalns over 2 years ago

  • Target version changed from 2.0 beta 1 to 2.1

#8 Updated by Robert Lemke about 2 years ago

  • Target version deleted (2.1)

#9 Updated by Aske Ertmann 9 months ago

  • Assigned To deleted (Aske Ertmann)

Also available in: Atom PDF