Feature #37405
When changing a property wich is used in routing the Link-VH should direkt to the new properties value
| Status: | Under Review | Start date: | 2012-05-22 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Aske Ertmann | % Done: | 0% |
|
| Category: | MVC - Routing | |||
| Target version: | - | |||
| PHP Version: | Complexity: | |||
| Has patch: | No | |||
| Votes: | 0 |
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.
History
Updated by Aske Ertmann about 1 year 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.
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.
Updated by Bastian Waidelich 12 months 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
Updated by Johannes Steu 12 months 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!
Updated by Gerrit Code Review 12 months 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
Updated by Karsten Dambekalns 11 months ago
- Assignee set to Aske Ertmann
Updated by Karsten Dambekalns 11 months ago
- Target version set to 2.0 beta 1
Updated by Karsten Dambekalns 5 months ago
- Target version changed from 2.0 beta 1 to 2.1
Updated by Robert Lemke 2 days ago
- Target version deleted (
2.1)