Bug #45384

Persisted entity object in widget-configuration cannot be deserialized (after reload)

Added by Benno Weinzierl over 2 years ago. Updated almost 2 years ago.

Status:New Start date:2013-02-11
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:Widgets
Target version:TYPO3 Flow Base Distribution - 2.0.1
Has patch:No Affected Flow version:Git master

Description

I have a widget with a persisted entity object (e.g. MyNamespace\SpecialProduct derived from MyNamespace\Product) in its widget-configuration.

The object gets serialized in the session and is accessable in a ajax-request (everything works).

BUT:
When i reload the page with the widget, the ajax calls fail with the following error:

Fatal error: ... The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "MyEntity" of the object you are trying to operate on was loaded before unserialize() gets called or provide a __autoload() function to load the class definition in "my widget ajax action controller" on line 65

I noticed that in Data/Temporary/Development/SubContextMyContext/Cache/Data/Flow_Session_Storage the entity is serialized. After reload the file contains the serialized entity two times. That seemes strange.

History

#1 Updated by Christian Müller over 2 years ago

I am not sure it is a good idea to try to add an entity to the widget context.
it should probably be represented only by it's identifier.
Generally I think it is a problem we should solve in the future (if possible), but a workaround might be to give only the identifier to the viewhelper and then in the ajax controller getting that object from persistence again.

#2 Updated by Christian Müller over 2 years ago

In order to be able to give an object to the viewhelper but serialize only the identifier you would have to overwrite the getAjaxWidgetConfiguration() method in your viewhelper (this in turn calls getWidgetConfiguration which you wuold need to overwrite too).

#3 Updated by Karsten Dambekalns almost 2 years ago

  • Target version changed from 2.0 to 2.0.1

Also available in: Atom PDF