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.