Bug #25902

It's not possible to add an entity as link/redirect argument

Added by Bastian Waidelich almost 10 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
Persistence
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

Related to TYPO3.Flow - Bug #25801: Request arguments should never contain objectsResolvedBastian Waidelich2011-04-06

Actions
#1

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))
}

#2

Updated by Karsten Dambekalns almost 10 years ago

  • Status changed from New to Accepted
  • Target version set to 1.0 beta 1
#3

Updated by Karsten Dambekalns over 9 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...

#4

Updated by Mr. Hudson over 9 years ago

Patch set 1 of change I8a5547ab34732c4c6db5369da14337cb3b7a3047 has been pushed to the review server.
It is available at http://review.typo3.org/1773

#5

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Accepted to Under Review
#6

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 40 to 100

Also available in: Atom PDF