How to export primary keys on data-dump?

When I export my database with doctrine:data-dump, I encounter 2 problems: * the primary keys are not exported * instead of foreign keys columns correct name, it uses the name of the foreign table.

For example, here are my tables:

# 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

When I dump, I find things like that in data.yml:

Planet_1:
  Solarsystem: _1

When I data-load that, it doesn't work (Invalid row key specified: (solarsystem) _1, referred to in (planet) Planet_1). I have to fix manually like this:

Planet_1:
  solarsystem_id: 1
  planet_id: 1

For the moment, I'm fixing the data.yml manually, but it begins to become a pain with all the records I'm accumulating...

Note: I'm using Symfony 1.4, Doctrine, postgreSQL, NetBeans, Windows. Feel free to ask information you would judge useful.

Thanks for your help

Answers


I recommend checking out this article entitled "Never Trust doctrine:data-dump": http://www.thomaskeller.biz/blog/2010/01/29/never-trust-doctrinedata-dump/

With that in mind, you may instead prefer checking out pg_dump: http://www.postgresql.org/docs/8.1/static/backup.html#BACKUP-DUMP

This dump is postgreSQL level, and as such is not likely to care about -- or stumble over -- your Doctrine schema.


Need Your Help

get highcharts data from table angularjs

javascript jquery angularjs highcharts

I'm trying to get highcharts data from html table using angularJS

Specflow use parameters in a table with a Scenario Context

c# .net bdd specflow gherkin

I am using Specflow in C# to build automatic client side browser testing with Selenium.