New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add allow-alias-relations
option to bake model command
#913
Conversation
I wonder if In general I like having it, since it has less change of failing if there is a unresolvable kind of relation in there. |
I agree! I also have a lot of tables where I just save an id to, say, a youtube video. I at some point started to name the fields What doesn't work with this PR though is e.g. if you have a |
Just checked the documentation. The term So |
What about having the option name reflect that it will generate associations for tables that don't exist? Names like |
Hmm.. if you save twitter user ids as |
I personally would prefer having a word describing that kind of relation. "Alibi" is already taken. Maybe "Pseudo-Relation" but that sounds odd. That name could also be used in the docs for the examples |
I am still for |
I renamed the option now. |
Thank you 🎉 |
Since PR #842 which was merged into 2.7.1, the bake model command skips the generation of relation-code, if the table does not actually exist in the database.
This might be unwanted behaviour for some more edge-case scenarios, e.g. when one table is used for multiple alias relations.
E.g., if you have an
addresses
table, you might want to have a fielddelivery_address_id
andinvoice_address_id
on yourcustomers
table, while using the same table andAddress
entity for both of them. You would just have to set theclassName
option for the two relations, so that they both point to a fieldaddresses.id
.Since
2.7.1
, the relations are not baked anymore, because there is no actualdelivery_addresses
table in the database.This PR introduces a new option
--allow-alias-relations
to skip the check for an existing table and to bake the relation code anyway.Related issue:
#912