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

Issues when requesting JSON or XML using Doctrine MongoDB ODM #447

Closed
onema opened this issue Apr 28, 2013 · 3 comments
Closed

Issues when requesting JSON or XML using Doctrine MongoDB ODM #447

onema opened this issue Apr 28, 2013 · 3 comments

Comments

@onema
Copy link

onema commented Apr 28, 2013

I have asked this question in StackOverflow before FOSRestBundle and JMS Serializer, error when geting JSON, and there was a good answer walking me through the correct way to setup the application, which I had before I decided to post the question. I decided to use Doctrine ORM rather than MongoDB ODM and the code worked.

Basically every time I request json or xml formats I get an error, I don't have the same problem if I request HTML format.

I'm wondering if there may be an issue with the latest version of the FOSRestBundle and the JMSSerializer when using Doctrine MongoDB ODM?

This is the full error message I get.

@stof
Copy link
Member

stof commented May 1, 2013

Well, from what I see in the stack trace, you are trying to serialize your logger, which contains a resource and so cannot be serialized.
It is because you are serializing a Doctrine\ODM\MongoDB\LoggableCursor which contains a reference to the Connection which itself contains the logger

@onema
Copy link
Author

onema commented May 1, 2013

I found a workaround to this issue, you can see the updated question in SO, although I don't think is ideal.

I'm still wondering what would be the best way to address this problem. If Doctrine ODM returns cursor for any query that contains more than one result... well that means Doctrine ODM can not be used out of the box with the serializer :( . Any alternatives other than my workaround?

Thanks for looking into this!

@lsmith77
Copy link
Member

lsmith77 commented May 1, 2013

I guess this is more of a question for the serializer, but there you can create a handler to deal with these kind of resources gracefully.

@lsmith77 lsmith77 closed this as completed May 1, 2013
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

3 participants