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

add an AnnotatedNormalizer service #4

Closed
lsmith77 opened this issue May 17, 2011 · 2 comments
Closed

add an AnnotatedNormalizer service #4

lsmith77 opened this issue May 17, 2011 · 2 comments

Comments

@lsmith77
Copy link
Contributor

Here is an example of a simple controller that can cause a validation error:
https://github.com/liip/HelloBundle/blob/master/Controller/HelloController.php#L69

In the case of a validation error a ConstraintViolationList instance is passed to the view layer which then needs to be normalized using the ValidatorConstraintViolationListNormalizer. However since ConstraintViolationList is 3rd party code I cannot add the annotations.

What do you propose here? Wrap the ConstraintViolationList into an annotated class?

Note in the FOSRestBundle I handle registering normalizers via the config for specific classes and for the above case I register a normalizer by default:
https://github.com/FriendsOfSymfony/RestBundle/blob/master/DependencyInjection/FOSRestExtension.php#L42

Also the FOSUserBundle Serializer has support for a fallback normalizer, I guess this is really what I would want to use here. Aka I would want to register the AnnotatedNormalizer as a fallback normalizer, but for this configureSerializer() doesnt really work well. What I would rather want is for the SerializerBundle to offer an AnnotatedNormalizer service I could reference that is setup with the naming/exclusion strategy the user has configured.

@schmittjoh
Copy link
Owner

The "annotations" branch contains a heavy refactoring. Can you check if it solves the issues you describe here?

@lsmith77
Copy link
Contributor Author

lsmith77 commented Jun 6, 2011

fixed indeed

@lsmith77 lsmith77 closed this as completed Jun 6, 2011
chasewoo pushed a commit to royuan/JMSSerializerBundle that referenced this issue Aug 7, 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

2 participants