我尝试使用JMS Serializer从AWS CloudSearch反序列化数据。
来自AWS Result的JSON编码数据如下所示:
{
id: 1234,
fields: {
"field1": ["value1"],
"field2": ["value2"]
}
}
实体序列化程序配置:
AppBundle\Entity\MyObject:
properties:
id:
type: integer
field1:
type: string
serialized_name: fields['field1']
// also tried: fields.field1, fields{field1}, and other permutations
结果对象:
object(AppBundle\Entity\MyObject)
private 'id' => int 1234
private 'field1' => null
是否有某种方法可以指定用于serialized_name
的哈希键,还是需要在反序列化之前预处理/展平数据?