doctrine:data-dump でデータベースをエクスポートすると、2 つの問題が発生します: * 主キーがエクスポートされない * 外部キー列の正しい名前の代わりに、外部テーブルの名前が使用されます。
たとえば、ここに私のテーブルがあります:
# schema.yml
Planet:
connection: doctrine
tableName: planet
columns:
planet_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
sequence: planet_planet_id
solarsystem_id:
type: integer(4)
fixed: false
unsigned: false
notnull: false
primary: false
# some columns...
relations:
Solarsystem:
local: solarsystem_id
foreign: solarsystem_id
type: one
# other relations...
Solarsystem:
connection: doctrine
tableName: solarsystem
columns:
solarsystem_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
sequence: solarsystem_solarsystem_id
# other columns...
relations:
Planet:
local: solarsystem_id
foreign: solarsystem_id
type: many
# other relations
ダンプすると、data.yml に次のようなものが見つかります。
Planet_1:
Solarsystem: _1
それをデータロードすると、機能しません (指定された無効な行キー: (solarsystem) _1、(planet) Planet_1 で参照)。次のように手動で修正する必要があります。
Planet_1:
solarsystem_id: 1
planet_id: 1
とりあえず、手動でdata.ymlを修正しているのですが、どんどんレコードが溜まっていくのが面倒くさい…。
注: Symfony 1.4、Doctrine、postgreSQL、NetBeans、Windows を使用しています。役に立つと判断した情報を気軽に尋ねてください。
ご協力いただきありがとうございます