Skip to content

Commit a4c2cd0

Browse files
committed
Hydrate object call on client
1 parent aed9fff commit a4c2cd0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Generator/Client.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
314314
))
315315
);
316316

317+
$class->addStmt(
318+
$factory->method('hydrateObject')->makePublic()->setReturnType('object')->addParam(
319+
(new Param('className'))->setType('string')
320+
)->addParam(
321+
(new Param('data'))->setType('array')
322+
)->addStmt(new Node\Stmt\Return_(
323+
new Node\Expr\MethodCall(
324+
new Node\Expr\PropertyFetch(
325+
new Node\Expr\Variable('this'),
326+
'hydrator'
327+
),
328+
new Node\Name('hydrateObject'),
329+
[
330+
new Node\Arg(new Node\Expr\Variable('className')),
331+
new Node\Arg(new Node\Expr\Variable('data')),
332+
]
333+
)
334+
))
335+
);
336+
317337
yield new File($namespace . '\\' . 'Client', $stmt->addStmt($class)->getNode());
318338
}
319339
}

0 commit comments

Comments
 (0)