1

I'm trying to reverse generate some new entities in my application using --filter option to select only the new ones.

php app/console doctrine:mapping:convert yml ./src/MyProject/MyBundle/Resources/config/doctrine/metadata/orm --filter="NewTable" --from-database --force

And I get an error message from a preexisting table, already mapped and working (actually not explicitly mapped as it is a Many to many relation table)

Table your_other_table has no primary key

My questions are:

  1. I know Doctrine has issues generating from tables without primary key but in this case I want to ignore it with the --filter param, I don't even need an entity for this, then why do I get this error?

  2. I usually work with own primary keys for every table, even in relation tables, I think I was "forced" to eliminate primary key in this many to many relation table in order to make relation in entities work, is this correct? Doctrine eliminates primary keys in relation tables? (I mean, they have PK but it is composed by the 2 foreign keys).

j0k
  • 22,600
  • 28
  • 79
  • 90
K. Weber
  • 2,643
  • 5
  • 45
  • 77
  • 1
    For your first question : even if you use the filter param doctrine will scan all your tables to make his mapping so if you've an issue in another table doctrine will fail the generation. For your second question : do you delete your primary keys in your link table? Can you show us your entity yml ? – Snroki Mar 11 '13 at 10:53
  • There is no yml for that link table, in the main entity I set a manytomany relation to the secondary entity and the link_table is no used. Actually, I added an identity primary key to the relation table and it seems to work ok so I managed to generate new entities again. Thanks – K. Weber Mar 11 '13 at 11:11
  • Just curious, @j0k, why did you delete the "thank you" in the original post? – K. Weber Mar 11 '13 at 11:35
  • 1
    @K.Weber http://meta.stackexchange.com/a/3021/182741 – j0k Mar 11 '13 at 11:49

0 Answers0