Bug #45669

PersistentObjectConverter does not convert ValueObjects by __identity

Added by Carsten Bleicker over 2 years ago.

Status:New Start date:2013-02-20
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Flow 2.0.0 beta 1

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

PersistentObjectConverter.php Magnifier (2.6 kB) Carsten Bleicker, 2013-02-20 17:59

Also available in: Atom PDF