Bug #58996

ResourceManager adding to persistence

Added by Carsten Bleicker about 1 year ago. Updated about 1 year ago.

Status:New Start date:2014-05-21
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

Description

If youre using the resourceManager to create a resource from content f.e.
it creates the resourcepointer and adding it to persistence:
Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Resource/ResourceManager.php:276

i want to ask, why the resourcemanager is adding a resourcepointer directly to the persistence.
shouldnt this be done by annotations on the owning site wich receives this pointer?

imho just creating object should not lead to magic automaticly adding to the persistence.
i would simply expect, that this is done by cascading the object structure and its annotations for orm.

i was confused about the exception thrown that there is something new registered for the persistence
wich i definitly does not add by myself. it was thrown because of the $whitelist check of saferequests.

sure, it makes not realy a sense to create a resource if you dont want to persist.
but it also makes no sense to get an exception for new objects wich i never added by mysqlf into the persistence.
my expactation is: "do whatever you want. create objects, destroy them, etc. the persistence is only involved if you explicit want it to. be sure, anything is save until you add it."

History

#1 Updated by Samir Rachidi about 1 year ago

I have got the same problem. Some ResourcePointer is added to the persistence and because of the safe request check, an exception is thrown. And I am not persisting any objects during my controller action

So, the whole application cannot be used now because of this exception. The only way (for me) to resolve this by now is to set $onlyWhitelistedObjects to TRUE inside the persistAll() method (class TYPO3\Flow\Persistence\Doctrine\PersistenceManager), so that the resourcepointer will get persisted one time.

public function persistAll($onlyWhitelistedObjects = FALSE) {
        $onlyWhitelistedObjects = FALSE;
...

After that, i can restore the persistAll() method and everything works fine.

we are using Typo3 Flow 2.2.0-beta4

Also available in: Atom PDF