Bug #4441
Route does not correctly replace domain objects in resolve()
Status: | Resolved | Start date: | 2009-09-03 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
Category: | MVC | |||
Target version: | TYPO3 Flow Base Distribution - 1.0 alpha 4 | |||
PHP Version: | Complexity: | |||
Has patch: | Affected Flow version: |
Description
At the end of \F3\FLOW3\MVC\Web\Routing\Route::resolve() remaining objects are transformed into respective UUIDs.
But there are two issues with that:
1. values are replaced directly instead of creating an array:
$route->resolves(array('someObject' => $someObject));
expected:
?someObject[__identity]=XXXX-XXXX-XXXX-XXXX
actual:
?someObject=XXXX-XXXX-XXXX-XXXX
-
2. This does not work for multi dimensional arrays:
$route->resolves(array('foo' => array('someObject' => $someObject)));
expected:
?foo[someObject][__identity]=XXXX-XXXX-XXXX-XXXX
actual: Exception(!)
-
This might be a chance to forwardport something from extbase. There we have
protected function convertDomainObjectsToIdentityArrays(array $arguments) { foreach ($arguments as $argumentKey => $argumentValue) { if ($argumentValue instanceof Tx_Extbase_DomainObject_AbstractEntity) { $arguments[$argumentKey] = array('uid' => $argumentValue->getUid()); } elseif (is_array($argumentValue)) { $arguments[$argumentKey] = $this->convertDomainObjectsToIdentityArrays($argumentValue); } } return $arguments; }
in the new UriBuilder.
Patch follows
Associated revisions
[+BUGFIX] FLOW3 (MVC): resolve() in Router now handles (nested) domain objects correctly, fixes #4441.
History
#1 Updated by Bastian Waidelich almost 6 years ago
- File 4441_Route_does_not_correctly_replace_domain_objects_in_resolve.patch added
- Status changed from New to Needs Feedback
- Assigned To changed from Bastian Waidelich to Robert Lemke
Attached patch seems to fix the issues.
@Robert: Please validate the patch and commit if applicable.
#2 Updated by Bastian Waidelich almost 6 years ago
The provided patch "4441_Route_does_not_correctly_replace_domain_objects_in_resolve_v2.patch" tweaks the error message that is displayed if objects without identity are passed to the resolves() method.
#3 Updated by Bastian Waidelich almost 6 years ago
Bastian Waidelich wrote:
The provided patch [...] tweaks the error message [...]
Damn it, the error message still contains a typo.. Dear comitter please fix ;)
#4 Updated by Karsten Dambekalns almost 6 years ago
- Status changed from Needs Feedback to Accepted
- Assigned To changed from Robert Lemke to Karsten Dambekalns
- Target version set to 1.0 alpha 4
#5 Updated by Karsten Dambekalns almost 6 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r3134.