Q:

Symfony2 Doctrine2 - generate Many-To-Many annotation from existing database by doctrine:mapping:import

I want to  generate Entities from an Existing Database by using Doctrine tools for reverse engineering
you can ask Doctrine to import the schema and build related entity classes by executing the following two commands.
1 $ php app/console doctrine:mapping:import AcmeBlogBundle annotation
  2 $ php app/console doctrine:generate:entities AcmeBlogBundle
but now the doctrine detect only ManyToOne relation in many side only "ProviderCountry" table
if i need to add the ManyToMany relation i have to add the annotation by my hand by adding the follwing annotation 
in Country.php add 
/**
 * 
 * @var Provider $provider
 * 
 * @ORM\ManyToMany(targetEntity="Provider")
 * @ORM\JoinTable(name="provider_country",
 *      joinColumns={@ORM\JoinColumn(name="countryId", referencedColumnName="id")},
 *      inverseJoinColumns={@ORM\JoinColumn(name="providerId", referencedColumnName="id")}
 *      )
 * */
private $providers;

in Provider.php add
  /**
     * @var Country $country
     * 
     * @ORM\ManyToMany(targetEntity="Country")
     * @ORM\JoinTable(name="provider_country",
     *      joinColumns={@ORM\JoinColumn(name="providerId", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="countryId", referencedColumnName="id")}
     *      )
     * */
    private $countrys;

so how can I generate Many-To-Many annotation by doctrine command [doctrine:mapping:import]
Thanks in advance.

A:

you can do this by add the following lines in 
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
 $tables = array();
    $tables[] = $schemaManager->listTableDetails("country");
    $tables[] = $schemaManager->listTableDetails("provider_country");
    $tables[] = $schemaManager->listTableDetails("provider");
    $this->setTables($schemaManager->listTables(), $tables);

inside __construct  
public function __construct(AbstractSchemaManager $schemaManager)

Note:
That will override OneToMany annotation. 

