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

Cannot redeclare class doctrine\orm\mapping\annotation #339

Closed
masterkaos opened this issue Nov 8, 2013 · 2 comments
Closed

Cannot redeclare class doctrine\orm\mapping\annotation #339

masterkaos opened this issue Nov 8, 2013 · 2 comments

Comments

@masterkaos
Copy link

I am having this really weird issue, and I am not sure if it is an issue with JMSSerializerBundle or Symfony.

I used the built in FormErrorHandler class and it outputted fine. However, I wanted to change the format of the output, so decided to write my own.

So I went into my services and added the new class

    jms_serializer.form_error_handler:
        class: MyCompany\MyBundleBundle\Services\FormErrorHandler

When running with the new class (clearing cache and everything) I kept getting error
Cannot redeclare class doctrine\orm\mapping\annotation

I tried debugging it but coulodn't figure out source of issue.

I then when into
JMS\SerialzierBundle\Resources\config\services.xml and replaced the form error handler class in that file with the new one, and then it worked fine with no exception

I had a custom FormErrorHandler in another project that worked fine using my above setup, but implementing it on this new project doesn't work. I may be running a new version of JMSSerializerBundle than my other project.

I thought maybe an issue with overwriting the service but I completely removed parameter key from the JMS config but still same issue.

As a temporary fix I will change the class in the JMS config, but don't like this option as if it gets upgraded then I will need to make the change again. Anyone have any ideas?

@masterkaos
Copy link
Author

Well I found another solution
In the parameters.yml file I added

jms_serializer.form_error_handler.class: MyCompany\MyBundle\Services\FormErrorHandler

And that worked.

Still curious what is wrong with the first solution but oh well

@goetas
Copy link
Collaborator

goetas commented Apr 3, 2017

looks solved

@goetas goetas closed this as completed Apr 3, 2017
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

No branches or pull requests

2 participants