Bug #13559
ObjectSerializer failes with persistent objects within arrays
Status: | Accepted | Start date: | 2011-03-02 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 0% |
|
Category: | Persistence | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | FLOW3 1.0.0 |
Description
If a persistent object is contained in an array property, the serialization failes. It won't detect the object as persistent but will persist it as if it was a simple data object. This will be broken as soon as the session is resumed/ the object serializer is unserializing this data stream.
The reason is that persistent object detection is only present in method serializeObjectAsPropertyArray. Method buildStorageArrayForArrayProperty only contains a small is_object that won't respect the persistence:
if (is_object($value)) { $storableArray[$key][self::TYPE] = 'object'; $storableArray[$key][self::VALUE] = spl_object_hash($value); $this->serializeObjectAsPropertyArray($value, FALSE); }
Related issues
History
#1 Updated by Karsten Dambekalns almost 4 years ago
- Affected Flow version set to FLOW3 1.0.0
#2 Updated by Christian Müller over 3 years ago
- Status changed from New to Needs Feedback
- Has patch set to No
Persistable Objects should best be stored in a Doctrine Collection like the ArrayCollection. Then persistence will persist the objects properly. Do we still want to fix this somehow?
#3 Updated by Karsten Dambekalns over 2 years ago
- Category set to Persistence
- Status changed from Needs Feedback to Accepted
- Assigned To set to Karsten Dambekalns
Possible without too much hassle.