Bug #25902
It's not possible to add an entity as link/redirect argument
Status:
Resolved
Priority:
Must have
Assignee:
Category:
Persistence
Target version:
Start date:
2011-04-12
Due date:
% Done:
100%
Estimated time:
PHP Version:
Has patch:
Complexity:
Description
It's very common to redirect to a details view after creating an entity:
public function createAction(Foo $foo) { $this->fooRepository->add($foo); $this->redirect('show', NULL, NULL, array('foo' => $foo)) }
But that won't work because the entity is not (yet) known to the Persistence Manager, which is asked for the identity of the object in the Route in order to convert Objects to Identity arrays:
...if (is_object($routeValue)) { $uuid = $this->persistenceManager->getIdentifierByObject($routeValue);
...
Related issues
Updated by Bastian Waidelich almost 10 years ago
- Priority changed from Should have to Must have
Additional notes:
Calling
$this->persistenceManager->persistAll();
before redirecting solves the issue temporarily but I have the same issue for updates, where this work around has no effect, so this is a real blocker currently:
public function updateAction(Foo $foo) { $this->fooRepository->update($foo); $this->redirect('show', NULL, NULL, array('foo' => $foo)) }
Updated by Karsten Dambekalns almost 10 years ago
- Status changed from New to Accepted
- Target version set to 1.0 beta 1
Updated by Karsten Dambekalns almost 10 years ago
- % Done changed from 0 to 40
Partly solved, as new entities now have an identifier for their whole lifetime (generated through AOP).
Leaves the update case open...
Updated by Mr. Hudson almost 10 years ago
Patch set 1 of change I8a5547ab34732c4c6db5369da14337cb3b7a3047 has been pushed to the review server.
It is available at http://review.typo3.org/1773
Updated by Karsten Dambekalns almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 40 to 100
Applied in changeset c7f66e0867f6de610706e1a53d64554852157e40.