Bug #45384

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

Added by Benno Weinzierl over 8 years ago. Updated about 8 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Widgets
Start date:
2013-02-11
Due date:
% Done:

0%

Estimated time:
Has patch:
No

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.

#1

Updated by Christian Müller over 8 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 8 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 about 8 years ago

  • Target version changed from 2.0 to 2.0.1

Also available in: Atom PDF