Jmsserializerbundle: Alias not working any more with 1.3

Created on 29 Mar 2017  路  8Comments  路  Source: schmittjoh/JMSSerializerBundle

It seems that the following configuration not working any more:

    acme_app.graphql_validator:
        class: "%acme_app.graphql_validator.class%"
        parent: core_bundle.abstract_service
        arguments:
            - "@serializer"
            - "@validator"

    jms_serializer.object_constructor:
        alias: acme_app.doctrine_object_constructor
        public: false

    acme_app.doctrine_object_constructor:
         class:        Acme\AppBundle\Serializer\DoctrineObjectConstructor
         arguments:    ["@doctrine", "@jms_serializer.unserialize_object_constructor"]

The DoctrineObjectConstructor is not called, so the unserialization process does not work (object constructor is not called).

Is there a change with version 1.3 on aliases or some other arguments that could cause this?
It works with previously version 1.2.1.

bug

Most helpful comment

All 8 comments

https://github.com/schmittjoh/JMSSerializerBundle/pull/391 has been merged... it can be a candidate to be guilty pull request

ah, found, you are defining manually the jms_serializer.object_constructor alias, that gets overwritten in https://github.com/schmittjoh/JMSSerializerBundle/blob/master/DependencyInjection/Compiler/DoctrinePass.php#L43

Probably we should skip the alias definition if already exists. Can you confirm?

Another thing that changed is the step registration

- $builder->addCompilerPass(new DoctrinePass(), PassConfig::TYPE_BEFORE_REMOVING);
+ $builder->addCompilerPass(new DoctrinePass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);

Can you check if putting the old step, works?

I will try that in the next few secondes.

It works perfectly when rollback to PassConfig::TYPE_BEFORE_REMOVING.

:( i was worried when merging it, going to creare a 1.3.1 release in the next minutes

Impressive reactivity! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renan-taranto picture renan-taranto  路  5Comments

Chrysweel picture Chrysweel  路  7Comments

priestor picture priestor  路  12Comments

grimabe picture grimabe  路  6Comments

mehdi-zarrin picture mehdi-zarrin  路  6Comments