doctrine2: how to convert a one-to-many to a many-to-many without losing data
问题 In my application, I want to convert a one-to-many to a many-to-many without losing the data : from: /** * @ORM\ManyToOne(targetEntity="\AppBundle\Entity\FoodAnalytics\Recipe", inversedBy="medias") * @ORM\JoinColumn(name="recipeId", referencedColumnName="id", onDelete="CASCADE") */ protected $recipe; to: /** * @ORM\ManyToMany(targetEntity="\AppBundle\Entity\FoodAnalytics\Recipe", inversedBy="medias") * @ORM\JoinTable( * name="media_recipes", * joinColumns={@ORM\JoinColumn(name="mediaId",