2017-10-21 83 views
1

这里我是symfony的新手,我试图设置两个id作为orm实体,它的第一个coloumn作为primarykey,但第二个coloumn没有出现在数据库中,任何人都可以帮助我解决这个问题。如何在Symfony中设置ORM两个实体ID

我的ORM实体

id: 
    merchantId: 
     type: merchant_id 
     column: merchant_id 
    auto_id: 
     type: integer 
     auto_id: true 
     column: auto_id 
     associationKey: true 
     generator: 
      strategy: AUTO 

MERCHANTID是我的UUID(PostgreSQL的DB), auto_id是自动递增的ID(1,2,3 ......)。

如何解决这个问题,如果可以的话,任何人都可以帮助我。

回答

0

当我映射它看起来像这样

SomeBundle\Entity\Example: 
    type: entity 
    table: example 
    id: 
     firstId: 
      type: integer 
      nullable: false 
      options: 
       unsigned: false 
      id: true 
      column: first_id 
     secondId: 
      type: string 
      nullable: false 
      length: null 
      options: 
       fixed: false 
      id: true 
      column: second_id 
    fields: 
     someExtraData: 
      type: string 
      nullable: true 
      length: null 
      options: 
       fixed: false 
      column: some_extra_data 
    lifecycleCallbacks: { } 

的实体,您可以尝试两种方式德兴实体和mappit或更新您的实体声明。

相关问题