mysql - doctrine one table is referenced by multiple tables, how can i get the reference record without switch -
imaging have 3 tables, person, boy, girl
table person{ id ...} table boy{ id, foreign key a_id= a.id, 1 one, description, ... } table girl{ id, foreign key a_id= a.id, 1 one, description, ... }
table person can referenced once boy or girl. if person id, how can boy/girl information without trying initiate boy , girl? cause problem have many tables referenced table person, , if long.
i think better way place table name in person table ,, i.e add column in person table have name of table boy , girl etc.
then can refer correct table
Comments
Post a Comment