Naming a relation in Doctrine 2 ORM?

后端 未结 2 1942
野的像风
野的像风 2021-02-06 01:07

How can i set the name of the foreign key (edit: not the name of the attribute itself) for the many-to-one relation \"region\" using YAML?

SWA\\         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 02:09

    Look at the getCreateConstraintSQL method in the AbstractPlatform class to see how the name of the foreign key is chosen (line 1088).

    It is taken directly from the constraint name. Influencing constraint name will influence the foreign key name.

    As a workaround you could drop the constraint and re-create it with a new name in a doctrine migration.

提交回复
热议问题