Symfony2: Duplicate definition of column 'id' on entity in a field or discriminator column mapping

Actually I found yml files in Resources/config/doctrine/, which were defining my entities, instead of just using annotations.

I removed these files and it's working now.

Thanks for your help !


I had same issue even after adding definitions to yml file. I was trying to add weight & max weight to a class and was getting:

Duplicate definition of column 'weight_value' on entity 'Model\ClientSuppliedProduct' in a field or discriminator column mapping.

Then I realized it requires columnPrefix to be different for similar types of fields and adding following in yml solved it for me:

`maxWeight:`
  `class: Model\Weight`
  `columnPrefix: max_weight_`

I had the same problem and error message but for me it was the other way around as @user2090861 said.

I had to remove the (unused)

use Doctrine\ORM\Mapping as ORM;

from my entity files, cause my real mapping comes from the orm.xml files.

I hope I can help with my answer many other people, cause this exception drove me crazy the last two days!