duc*_*cin 1 php doctrine model primary-key symfony
任何人都可以粘贴一个Symfony2/ Doctrinemodel 的示例定义,其主键不同于id(名称,例如主键是customer_id)?
我一直在网上搜索这个,我扫描了整个cheatsheet(http://ormcheatsheet.com/)但找不到一个.
例如,具有以下架构:
author:
type: entity
fields:
id:
id: true
type: integer
generator:
strategy: AUTO
Run Code Online (Sandbox Code Playgroud)
我应该更改什么来替换id与author_id保留它仍然是主键?
像这样的东西?
author:
type: entity
id:
author_id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 50
Run Code Online (Sandbox Code Playgroud)