Bug #57374

Persisted entities saved in session are not resolved

Added by Aimo Künkel over 1 year ago. Updated over 1 year ago.

Status:New Start date:2014-03-27
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:Session
Target version:TYPO3 Flow Base Distribution - 2.x Estimated time:1.00 hour
PHP Version: Complexity:easy
Has patch:No Affected Flow version:(any)

Description

If you save a persisted entity in the session via

$this->session->putData("myEntity", $myEntity);

it is saved like some normal entity.

So later on if you do

$sessionEntity = $this->session->getData("myEntity");
$persistedEntity = $this->entityRepository->findByIdentifier( $sessionEntity->getIdentifier() );
\TYPO3\Flow\var_dump($sessionEntity);
\TYPO3\Flow\var_dump($persistedEntity);
\TYPO3\Flow\var_dump($sessionEntity === $persistedEntity);
die();

it show you twice the same object, but it's not the same.

It should instead just save the id in the background and fetch it again from the repo in case of a persisted entity.
Otherwise it's impossible to work with, because you e.g. can't pass it to the repo for updating and so on.

I'll provide a patch if wished, just comment please.

Also available in: Atom PDF