8000 [AstGenerator] [WIP] New Component, add normalizer generator by joelwurtz · Pull Request #17516 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[AstGenerator] [WIP] New Component, add normalizer generator #17516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Prev Previous commit
Next Next commit
Include the normalizer in the context
  • Loading branch information
GuilhemN authored and joelwurtz committed Aug 5, 2016
commit d9b46302b04b92d776bbfd8274778acc74708a33
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ public function generate($object, array $context = [])
'implements' => [
new Name('\Symfony\Component\Serializer\Normalizer\DenormalizerInterface'),
new Name('\Symfony\Component\Serializer\Normalizer\NormalizerInterface'),
new Name('\Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface'),
],
'extends' => new Name('\Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer'),
'uses' => new Name('\Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait'),
]
)];
}
Expand Down Expand Up @@ -161,7 +162,11 @@ protected function createNormalizeMethod($class, array $context = [])
],
'stmts' => array_merge($this->normalizeStatementsGenerator->generate($class, array_merge($context, [
'input' => $input,
'output' => $output
'output' => $output,
'normalizer' => new Expr\MethodCall(
new Expr\Variable('$this'),
'getNormalizer'
)
])), [
new Stmt\Return_($output)
])
Expand Down
0