-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
SF4: JMS serializer seems to be ignoring global naming strategy #1037
Comments
I tested:
Edit jms_serializer:
property_naming:
id: jms_serializer.identical_property_naming_strategy
visitors:
xml_serialization:
format_output: '%kernel.debug%' and the naming strategy was applied as expected. |
Please provide more info to test your issue (as example a skeleton project on a github repo) |
Hi goetas; Thanks for the reply a specificity maybe not mentionned is that I am Using here is my non working instantiation: use JMS\Serializer\SerializerInterface;
/**
* @param SerializerInterface $serializer
*/
public function searchBarLookup (SerializerInterface $serializer) {
....
$data = $serializer->serialize($list, 'json');
return $this->json($data);
}
It works if I instantiate a new serializer only (like the following) but as a global setting I have no luck at all. $serializer = \JMS\Serializer\SerializerBuilder::create()
->setPropertyNamingStrategy(
new SerializedNameAnnotationStrategy(
new IdenticalPropertyNamingStrategy()
)
)
->build(); If I intentionally put a bad character in Is it possible that the global setting gets overridden somewhere down the line ? |
I have the same issue. Symfony 4.3.2. |
If you are using the bundle, consider schmittjoh/JMSSerializerBundle#767 |
I had to manually delete the cache ( |
I think this is recurring jms/serializer-bundle 4.0.1 and Symfony 6.0.7
This works
This works
This does not work like settings in yaml are ignored
Could be I am doing it wrong but would one have expressions enabled with respect to jms_serializer.yaml ? Just a side note:
|
|
I was pointed to this by google because I am trying to find out how to set groups when calling serialize() without the need to programmatically set the options I already have configured in the bundle. |
If i autowire the SerializerInterface in Symfony 6.4 the settings from the yaml don't seem to be respected.
Would appreciate it if somebody could point me to a solution here. Don't like that constructor-thingy very much. Though I really do like the Serializer otherwise! |
symfony 4.2
"jms/serializer-bundle": "^3.1",
using dependency injecton in my controller function with
SerializerInterface $serializer
in my
config > packages > jms_serializer.yaml
I have the following code but it has not effect whatsoever. Is this normal ? How do we override the default_
naming strategy toidentical
?I am NOT using any other settings anywhere. I literally just installed the bundle and try to configure it.
The text was updated successfully, but these errors were encountered: