-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Point out aliasing object_constructor to doctrine_object_constructor not necessary #808
Comments
I am not able to configure a custom object constructor anymore that uses "jms_serializer.doctrine_object_constructor" as fallback (injected in the constructor). This also throws a "ServiceCircularReferenceException". |
I think that this is a unintentional BC break introduced with #803 To solve your issue you should use symfony decorators (https://symfony.com/doc/current/service_container/service_decoration.html) and decorate the |
Would be great if you could add a note on the documentation mentioning this :) |
I am struggling with this. I'd like to configure a custom constructor that uses the doctrine constructor as fallback. Would be great if you could show me how this can be achieved. |
The change made in #803 was actually BC breaking in my case: the bundle started using a different object constructor by default, breaking my implementation. |
@bobvandevijver i'm sorry for that... |
had similar problem since we upgraded from
to
|
Hello, Unfortunately, we faced the same BC. It would be nice to update the documentation at https://jmsyst.com/bundles/JMSSerializerBundle because many of the new features introduced in lastest versions are not referenced there. As described by @goetas, we fixed our implementation using the decoration api. services:
jms_serializer.object_constructor:
stack:
- App\Service\CustomObjectConstructor: ['@doctrine', '@.inner']
- JMS\Serializer\Construction\UnserializeObjectConstructor: ~ However, upon investigation, we found that the default constructor is now Our implementation is an override of the doctrine constructor, so we additionally disabled the default behavior to only use the fallback instance constructor jms_serializer:
object_constructors:
doctrine:
enabled: false Enjoy 🎉 |
After upgrading to the newest release of JMSSerializerBundle, Symfony started throwing
Upon investigation, I found out this was part of my configuration:
It appears this snippet was necessary before introduction of
DependencyInjection/Compiler/DoctrinePass.php
. However, if I understand things correctly, it is not necessary to alias object_constructor to doctrine_object_constructor anymore. Is this correct? If so, it would be nice to update documentation in relation to this.The text was updated successfully, but these errors were encountered: