2014-01-29 73 views
1

我想列添加到使用格式現有表yml.Added新列 項爲.yml文件並運行該命令生成實體添加列如何使用表Symfony2的學說

PHP應用程序/控制檯學說:生成:實體PLibBundle:聯繫

通過運行此得到一個錯誤「爲實體沒有標識符/主鍵指定」

這裏是我的YML文件:

 
Application\PLibBundle\Entity\Contact: 
    type: entity 
    table: null 
    fields: 
    id: 
     type: integer 
     length: null 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
     id: true 
     generator: 
     strategy: IDENTITY 
    firstName: 
     type: string 
     length: 255 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
    lastName: 
     type: string 
     length: 255 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
    companyText: 
     type: string 
     length: 255 
     precision: 0 
     scale: 0 
     nullable: true 
     unique: false 
    email: 
     type: string 
     length: 255 
     precision: 0 
     scale: 0 
     nullable: true 
     unique: true 
    hasCustomHeadshot: 
     type: boolean 
     length: null 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
    createdOn: 
     type: datetime 
     length: null 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
    updatedOn: 
     type: datetime 
     length: null 
     precision: 0 
     scale: 0 
     nullable: false 
     unique: false 
    oneToOne: 
    address: 
     targetEntity: Application\PLibBundle\Entity\Address 
     cascade: 
     - remove 
     - persist 
     mappedBy: null 
     inversedBy: null 
     joinColumns: 
     addressId: 
      referencedColumnName: id 
     orphanRemoval: true 
    oneToMany: 
    phoneNumberAssociations: 
     targetEntity: Application\PLibBundle\Entity\ContactPhoneNumberAssociation 
     cascade: 
     - remove 
     - persist 
     mappedBy: contact 
     inversedBy: null 
     orphanRemoval: true 
     orderBy: null 
    subscriptionAssociations: 
     targetEntity: Application\PLibBundle\Entity\ContactSubscriptionAssociation 
     cascade: 
     - remove 
     - persist 
     mappedBy: contact 
     inversedBy: null 
     orphanRemoval: true 
     orderBy: null 
    manyToOne: 
    company: 
     targetEntity: Application\PLibBundle\Entity\Company 
     cascade: { } 
     mappedBy: null 
     inversedBy: null 
     joinColumns: 
     companyId: 
      referencedColumnName: id 
     orphanRemoval: false 
    lifecycleCallbacks: 
    prePersist: 
     - beforePersist 
    preUpdate: 
     - beforeUpdate 

回答

3

異常消息幾乎解決了這個謎題,你有這樣的事情嗎?

Contact: 
    type: entity 
    id: 
    id: 
     type: integer 
     generator: 
     strategy: AUTO 
    fields: 
    name: 
     type: string 
     length: 100 
+0

是類似這樣的東西,我想多了一個額外的領域出現和更新實體是可能 – user3173000

+0

請問我的編輯你明白了嗎? –

+0

無法發佈我的yml文件在適當的格式,我已修改的問題,我試圖在那裏添加 – user3173000