0
我試圖合併兩個實體(用戶和學生)來創建一個單一的形式,下面是我的ORM文件錯誤上試圖Symfony的合併兩種形式(entites的)2
Ens\JobeetBundle\Entity\User:
type: entity
table: abc_user
id:
user_id: { type: integer, generator: { strategy: AUTO } }
fields:
username: { type: string, length: 255, notnull: true, unique: true }
email: { type: string, length: 255, notnull: true, unique: true }
password: { type: string, length: 255, notnull: true }
enabled: { type: boolean }
oneToOne:
student:
targetEntity: Ens\JobeetBundle\Entity\Student
mappedBy: user
Ens\JobeetBundle\Entity\Student:
type: entity
table: abc_student
id:
student_id: { type: integer, generator: { strategy: AUTO } }
fields:
first_name: { type: string, length: 255, notnull: true }
middle_name: { type: string, length: 255 }
last_name: { type: string, length: 255, notnull: true }
oneToOne:
user:
targetEntity: Ens\JobeetBundle\Entity\User
joinColumn:
name: user_id
referencedColumnName: user_id
創建實體和更新方案做工精細,
php app/console doctrine:generate:entities EnsJobeetBundle
php app/console doctrine:database:update --force
但試圖生成CRUD
php app/console generate:doctrine:crud --entity=EnsJobeetBundle:Student
我與結束了的時候以下錯誤,
[RuntimeException]
The CRUD generator expects the entity object has a primary key field named "id" with a getId() method.
是否有任何知道如何擺脫這種情況?如何合併Symfony 2中的兩個表單?
任何幫助將非常感激......
這些干將中已存有每班 – user1583629 2012-08-09 03:52:29
我有edi我的答案 – Mick 2012-08-09 10:36:34