-
-
Notifications
You must be signed in to change notification settings - Fork 588
Open
Description
| Q | A |
|---|---|
| Bug report? | no |
| Feature request? | no |
| BC Break report? | maybe? |
| RFC? | no |
I am upgrading an old application that was using jms/serializer 1.14.1. I have upgraded it to 3.24.0 and am seeing different behavior that wasn't reported as a BC and I'm not finding any information about how to get back to the old ways.
The issue revolves around serializing \stdClass objects. Previous behavior would be to apply the property naming strategy, which by default meant converting camel case to snake case. On the newer version, however, \stdClass does not appear to use the property naming strategy, even if defined explicitly.
What am I missing?
Steps required to reproduce the problem
$data = (object) [
"success" => true,
"financingPartnerName" => "MoneyMan",
"dealerFee" => 6.5,
];
$serializer = \JMS\Serializer\SerializerBuilder::create()
->setPropertyNamingStrategy(new \JMS\Serializer\Naming\CamelCaseNamingStrategy())
->addDefaultHandlers()
->build();
$json = $serializer->serialize($data, 'json');
dump($json);
Expected Result
{
"success": true,
"financing_partner_name": "MoneyMan",
"dealer_fee": 6.5
}
Actual Result
{
"success": true,
"financingPartnerName": "MoneyMan",
"dealerFee": 6.5
}
Metadata
Metadata
Assignees
Labels
No labels