Monday 15 June 2015

php - Doctrine find related records without foreign keys -



php - Doctrine find related records without foreign keys -

i have 2 preexisting tables created cms. i've mapped them in symfony2 , trying found relationship between 2 of tables noticing cms created these tables without foreign key. table table_uploads has column every other table related called column_table_name , column_record_num.

so assuming have 3 tables... table_students, table_uploads, , table_teachers, table table_uploads have value of either students or teachers in column_table_name show relation other 2 tables number in column_record_num corresponds other table's primary key. neither of 3 tables have defined foreign key however.

in symfony, i'd phone call table

$students = $this->getdoctrine()->getrepository('schoolbundle:students')->findall();

and load related records table in such way (i know select_related doesn't exist, functionality i'm looking create)

$students->select_related()

is @ possible without existence of foreign key? way can think of doing grabbing column values $students , running query other table these values , merging 2 results.

you create custom repository method bring together unrelated tables. dql bring together between unrelated entities?

php symfony2 doctrine2

No comments:

Post a Comment