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
Symfony 4 - Class 'jms_serializer.stopwatch_subscriber' not found #610
Comments
#605 is still open (and symfony 4 is not yer released), means that this bundle is not yet fully compatible with symfony 4 |
Hi, this is not a symfony bug, you have to change configuration of services which you can retrieve directly from the container - according to symfony/dependency-injection@a043965#diff-09eda9d53bdc62a97ad02badf08be429
All services in symfony 4 are private, except explicit setup "public" flag on it |
I found out, that this services have to be public (because LazyEventDispatcher)
and
because LazyLoadingDriver Or you may change it and use lazy=true flag on service definition and remove Lazy* Services... |
this will be "solved" by the bundle right after the symfony release |
@goetas would it at least be possible to create a separate feature branch with this issue fixed? It would allow our team to move faster until S4 is released |
@Rastusik |
@kgasienica which bundle version are you using? |
@goetas great, thank you very much! |
@goetas it was
|
@kgasienica there is a chance that your specific problem was solved with |
After add those services in config.yml, there is still a problem with one service: |
Appears to still be broken in v2.2.0 @goetas, same with sf4-compat |
@kgasienica What error are you getting ? I just override the services in my services.yml and it's working fine. services:
jms_serializer.doctrine_proxy_subscriber:
class: JMS\Serializer\EventDispatcher\Subscriber\DoctrineProxySubscriber
public: true
tags:
- { name: jms_serializer.event_subscriber }
arguments:
- true
- false
jms_serializer.stopwatch_subscriber:
class: JMS\SerializerBundle\Serializer\StopwatchEventSubscriber
public: true
arguments:
- "?debug.stopwatch"
jms_serializer.datetime_handler:
class: JMS\Serializer\Handler\DateHandler
public: true
tags:
- { name: jms_serializer.subscribing_handler }
jms_serializer.array_collection_handler:
class: JMS\Serializer\Handler\ArrayCollectionHandler
public: true
tags:
- { name: jms_serializer.subscribing_handler }
# You may need to make public other handlers BTW services are private as default since 3.4 https://symfony.com/blog/new-in-symfony-3-4-services-are-private-by-default |
@luishdez yes, if you override this services, it works fine, but we expect it without overrideing.
This two are still required to be public. I create a pull request for it. #614 |
will be solved in #605 |
In Symfony 4 I have occured a problem with
JMSSerializerBundle
in use withFOSRestBundle
. My code looks like below:There is no problem when data is a pure array, but when there are even simple objects (f.ex. DateTime) that problem occurs.
Deleting
JMSSerializerBundle
fromKernel.php
fixes the problem, because Symfony takes his native serializer whenJMSSerializerBundle
is not found.Error:
The text was updated successfully, but these errors were encountered: