如果我的实体使用 GUID 字段类型作为标识符,如何在config_yml中定义映射?
细节
我有一个 Symfony 2.7.3 和 FosElasticaBundle 3.1.4 的项目。
我已经配置了映射,当我使用填充命令或编辑现有实体时一切正常;但是在创建新实体时出现异常
"expected a simple value for field [_id] but found [START_OBJECT]]"
检查 JSON 响应我注意到_id设置为空对象..."_id":{}...
。
Uuid类已经有一个__toString方法,我希望它可以解决问题,但我可能遗漏了一些东西。
当前映射
fos_elastica:
clients:
default: { host: %elasticsearch_host%, port: %elasticsearch_port%, logger: true }
indexes:
app:
types:
user:
mappings:
name: ~
surname: ~
persistence:
driver: orm
model: AppBundle\Entity\User
provider: ~
listener: ~
finder: ~
谢谢你。