I have this weird problem with the json_array field configuration.
I have configured field meant to store some configuration. Its configured like this:
<field name="config" type="json_array" />
For example, I have an array like this:
[
'choices' => [
'Other' => 'other',
'Male' => 'male',
'Female' => 'female'
]
]
I set the entity property:
$entity->setConfig($config);
And I persist it to the database. The result is this:
"choices": {
"Male": "male",
"Other": "other",
"Female": "female"
}
When I do json_encode on the same array, the order is not changed, but somehow Doctrine does change the order. Is there a way to prevent this from happening?