Skip to content
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

Use symfony decorators #803

Merged
merged 1 commit into from
Jun 13, 2020
Merged

Use symfony decorators #803

merged 1 commit into from
Jun 13, 2020

Conversation

goetas
Copy link
Collaborator

@goetas goetas commented Jun 6, 2020

Use symfony decorators to decorate metadata drivers and object constructors.

This simplifies a lot the code and makes possible a better decoration process. the previous implementation was self-implementing the decoration process

@mpoiriert
Copy link

This has some BC change because aliasing the service to replace the constructor is overridden by decoration now.

I was creating a alias my self of the jms_serializer.object_constructor to my service and now the decorator override it.

I am trying to find a way to be compatible with <= 3.6.0 and >= 3.7.0 at the same time.

@mpoiriert
Copy link

I endup doing a compiler pass:

`class JmsDoctrineObjectConstructionCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if(null === $container->getDefinition('jms_serializer.doctrine_object_constructor')->getDecoratedService()) {
return;
}

    $container->removeDefinition('jms_serializer.object_constructor');
    $container->setAlias('jms_serializer.doctrine_object_constructor', DoctrineObjectConstructor::class);
    $container->setAlias('jms_serializer.object_constructor', 'jms_serializer.doctrine_object_constructor');
}

}`

@goetas goetas deleted the decorators branch October 14, 2021 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants