php-crud-api icon indicating copy to clipboard operation
php-crud-api copied to clipboard

Multiple foreign keys to the same table

Open AlexanderSutul opened this issue 9 years ago • 5 comments

Hello! I use mysql with a lot of tables. And now I need to execute query with properties: author, executor, control. All of these uses the same table USERS, how can I resolve this problem without aliases?

P.S.: Thanks for your library =)

AlexanderSutul avatar Sep 08 '17 04:09 AlexanderSutul

@AlexanderSutul thank you for reaching out. I think you are right and I should have named the relations with the name of the relationship (fk constraint) or the foreign key column and not the name of the target table. This is quite a big refactoring and also a breaking change, so I may have to bump the major version. Not sure when, but this is an important improvement, thank you for reporting it!

mevdschee avatar Sep 11 '17 17:09 mevdschee

@mevdschee I very hope it will be soon.

AlexanderSutul avatar Sep 12 '17 01:09 AlexanderSutul

Firstly, I also want to thank you for your library. I am joining waiting to this enhancement and I would like to ask if there is some workaround in the meanwhile. I haven't been able to find solution in mysql - there is no aliases for tables, and views can't have indexes so they can't be used for foreign keys. Any idea? Thanks

hermes4269 avatar Jan 18 '18 09:01 hermes4269

Great library. Although it looks like this limitation is going to stop me in my tracks. It would be great to see a solution to this :) Thanks

mkmckenna avatar Feb 06 '18 08:02 mkmckenna

Good news! Version 2 is almost ready and it has this new feature. Please try the latest beta version out and let me know what you think.

mevdschee avatar Oct 04 '18 00:10 mevdschee