Bug #45669

PersistentObjectConverter does not convert ValueObjects by __identity

Added by Carsten Bleicker over 8 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-02-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

if you have valueObjects and want to show them in an action controller with
showAction($myValueObject) and get param comes in with &myObject[__identity]=123123-123123-231231
the converting fails because __identity will allways be unset and no other property left after this.
i solved this by simply adding 3 lines in the convertFrom method:

// if there is just only the identity we convert the source to string
if (is_array($source) && count($source) === 1 && array_key_exists('__identity', $source)) {
$source = $source['__identity'];
}

see also attached extended class with higher priority

do you agree with it?
thank you
carsten


Files

PersistentObjectConverter.php (2.63 KB) PersistentObjectConverter.php Carsten Bleicker, 2013-02-20 17:59

No data to display

Also available in: Atom PDF