Before I describe my problem, it might actually make it clearer if I start with the error I\'m getting:
$ ./app/console doc:mig:diff
[Doctrine\\DBAL\\Schema\\
According to the Association Mapping explanation on the official docs, the @JoinColumn
and @JoinTable
definitions are usually optional and have sensible default values, being:
name: "<fieldname>_id"
referencedColumnName: "id"
From that we can conclude that there is really no concrete difference between the two implementations you presented.
However, when it comes to migration, the creation of the table is a pretty common and expected behaviour. The thing is the table should always get deleted and created again, which is not happenning.
About the table name issue, the default behaviour of Doctrine 2 about this:
/**
* @ORM\ManyToMany(targetEntity="MediaArea", inversedBy="mediaAreas")
*/
private $mediaAreas;
Is to try and create a table called mediaarea
. Again, perfectly normal.
If you want to declare a specific name for the table of an entity, you should do this:
/**
* @ORM\Table(name="my_table")
*/
class Something
I'm not sure if that helps you at all, but I guess it puts you, at least, on the right track.