-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
EntityNotFoundException using softDeletable #101
Comments
I'm encountering this all over the place. The problem is that JMS Serializer sees the key in post to author, but when it tries to fetch the author Doctrine says it doesn't exist (because it has been soft deleted). I'm not sure how to go about this properly. It seems like a huge use case. |
@BraisGabin Any code in your app accessing the author will break if you soft delete it but you are still referencing it in a relation in another object. It is not a JMSSerializer issue. |
@stof I know that a post can have a soft deleted author in my model. So I check it in my code. The problem here is: how can I manage this inside JMSSerializer? Probabily it's not a JMSSerializer issue but a feature. |
you could use a custom exclusion strategy to exclude the author in such case |
In my API'm using softDeletable. This makes JMSSerialize throw the exception: EntityNotFoundException.
Example: A post with an author. I soft-delete the author and request the post.
The expected json is:
I tried to fix this problem and submit a PR but I couldn't fix it.
Any clues on how to do it?
Related:
http://stackoverflow.com/q/11057504/842697
https://github.com/l3pp4rd/DoctrineExtensions/issues/505#issuecomment-13351451
My really poor solution:
I can prevent the Exception with this:
at DoctrineProxySubscriber.php#L51.
The result is:
And I really don't know the collateral problems of this.
The text was updated successfully, but these errors were encountered: