Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/Generator/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,32 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
// yield new Node\Stmt\Echo_([new Node\Scalar\String_('/**' . @var_export($operationCall, true) . '*/')]);
}
})($operationCalls))
))->addStmt(
new Node\Stmt\Throw_(
new Node\Expr\New_(
new Node\Name('\InvalidArgumentException')
)
)
)
);

$class->addStmt(
$factory->method('hydrateObject')->makePublic()->setReturnType('object')->addParam(
(new Param('className'))->setType('string')
)->addParam(
(new Param('data'))->setType('array')
)->addStmt(new Node\Stmt\Return_(
new Node\Expr\MethodCall(
new Node\Expr\PropertyFetch(
new Node\Expr\Variable('this'),
'hydrator'
),
new Node\Name('hydrateObject'),
[
new Node\Arg(new Node\Expr\Variable('className')),
new Node\Arg(new Node\Expr\Variable('data')),
]
)
))
);

Expand Down
4 changes: 2 additions & 2 deletions src/Generator/WebHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function generate(string $namespace, string $baseNamespace, array
Class_::MODIFIER_PUBLIC
)
)->addStmt(
$factory->property('hydrator')->setType('\\' . $namespace . 'OptimizedHydratorMapper')->makeReadonly()->makePrivate()
$factory->property('hydrator')->setType('\\' . $baseNamespace . 'OptimizedHydratorMapper')->makeReadonly()->makePrivate()
)->addStmt(
$factory->method('__construct')->makePublic()->addStmt(
new Node\Expr\Assign(
Expand All @@ -62,7 +62,7 @@ public static function generate(string $namespace, string $baseNamespace, array
'hydrator'
),
new Node\Expr\New_(
new Node\Name('\\' . $namespace . 'OptimizedHydratorMapper'),
new Node\Name('\\' . $baseNamespace . 'OptimizedHydratorMapper'),
[
]
),
Expand Down