hydrator icon indicating copy to clipboard operation
hydrator copied to clipboard

Add dehydration

Open rustamwin opened this issue 2 years ago • 8 comments
trafficstars

rustamwin avatar May 07 '23 18:05 rustamwin

Can you describe you vision of concept?

vjik avatar May 08 '23 09:05 vjik

Do you mean serialization?

xepozz avatar May 08 '23 18:05 xepozz

I mean hydration and vice versa (aka toArray()).

rustamwin avatar May 08 '23 19:05 rustamwin

https://github.com/yiisoft/var-dumper/blob/master/src/VarDumper.php#L175 :)

xepozz avatar May 08 '23 19:05 xepozz

I mean hydration and vice versa (aka toArray()).

Seems, it's not hydrator package responsibility. Hydration is a one-way process, it's not serilization/deserilization.

vjik avatar May 09 '23 09:05 vjik

It's not deserialization exactly. We have Map attribute.

// request data is ['a' => 'foo', 'b' => 'bar']
#[Map(['x' => 'a', 'y' => 'b'])
class MyDto
{
    public string $x;
    public string $y;
}

Result of dehyration should be ['a' => 'foo', 'b' => 'bar'] not ['x' => 'foo', 'y' => 'bar'].

rustamwin avatar May 10 '23 14:05 rustamwin

$request->getParsedBody()?

xepozz avatar May 10 '23 14:05 xepozz

$request->getParsedBody()?

Any input.

rustamwin avatar May 10 '23 14:05 rustamwin