Bug #25902

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

Added by Bastian Waidelich over 4 years ago. Updated over 4 years ago.

Status:Resolved Start date:2011-04-12
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Persistence
Target version:TYPO3 Flow Base Distribution - 1.0 beta 1
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

It's very common to redirect to a details view after creating an entity:

1public function createAction(Foo $foo) {
2    $this->fooRepository->add($foo);
3    $this->redirect('show', NULL, NULL, array('foo' => $foo))
4}

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:

...
1if (is_object($routeValue)) {
2    $uuid = $this->persistenceManager->getIdentifierByObject($routeValue);

...


Related issues

related to TYPO3.Flow - Bug #25801: Request arguments should never contain objects Resolved 2011-04-06
related to TYPO3.Neos - Task #25803: NodeRoutePartHandler should not return a node object Resolved 2011-04-06

Associated revisions

Revision c7f66e08
Added by Karsten Dambekalns over 4 years ago

[BUGFIX] Make sure entities can be used in links/redirect

Now the Doctrine\PersistenceManager also checks for the FLOW3 identifier
introduced by AOP in getIdentifierByObject().

Fixes: #25902
Change-Id: I8a5547ab34732c4c6db5369da14337cb3b7a3047

History

#1 Updated by Bastian Waidelich over 4 years ago

  • Priority changed from Should have to Must have

Additional notes:
Calling

1$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:
1public function updateAction(Foo $foo) {
2     $this->fooRepository->update($foo);
3     $this->redirect('show', NULL, NULL, array('foo' => $foo))
4}

#2 Updated by Karsten Dambekalns over 4 years ago

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

#3 Updated by Karsten Dambekalns over 4 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 4 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 4 years ago

  • Status changed from Accepted to Under Review

#6 Updated by Karsten Dambekalns over 4 years ago

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

Also available in: Atom PDF