John Davidson

php - Can't add a new ManyToMany property between entity A to B because I already have a ManyToMany property with both these entity

0 comments
Message:


So basically title. I'm building a music player and I would like it so that my Songs have 2 property : artists and collab-artists.


I have a Song entity which has an "artists" relational ManyToMany property where I can link 1 (or more) Artist entity to the Song. I would like to have another relational ManyToMany property "collab-artists" with Song and Artist.


I can php bin/console make:entity to create the collab-artist property but when I php bin/console make:migration I get :


In SchemaException.php line 112: The table with name 'banana.song_artist' already exists.


Seems like symfony is trying to create a table to store the relationship, but it is already used. How can I tell it to create another table with a different name ?


Thanks,
Maxence


EDIT : I ended up using this solution https://stackoverflow.com/a/50344465/16267883


Which explodes the relation between 3 tables, Song > OneToMany > SongHasArtist > ManyToOne > Artist



My Answer:
you please provide more context or clarify your question?

Rate this post

5 of 5 based on 9060 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us