我有这个简单的测试实体在工作
App\Entity\Account:
type: entity
table: accounts
attributes:
id:
id:
type: integer
generator:
strategy: AUTO
length: null
unique: false
nullable: false
id: true
fields:
uuid:
type: guid
scale: 0
unique: true
nullable: false
name:
type: string
length: 255
unique: false
nullable: false
currency:
type: string
length: 3
unique: false
nullable: false
哪个返回此JSON
对象
{
"@context": "/contexts/Account",
"@id": "/accounts",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/accounts/1",
"@type": "Account",
"uuid": "376ac80f-70b9-4673-8ba0-d1aeb613fd4c",
"name": "The account 1 name",
"currency": "EUR",
"id": 1
},
{
"@id": "/accounts/2",
"@type": "Account",
"uuid": "55e878d4-5607-421b-9b90-16ae0d461e8d",
"name": "Account 2",
"currency": "USD",
"id": 2
}
],
"hydra:totalItems": 2
}
我目前使用id
作为数据库关系的内部参考,我需要:
uuid
设置为公共id
,这是通过API请求引用元素的唯一方法uuid
上的id
用作"@id": "/accounts/<UUID>",
id
(整数),仅供内部使用
我该如何使用yml
配置?