Skip to content
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

Column with *_id not generating a belongsTo relation anymore. #912

Closed
passchn opened this issue Mar 10, 2023 · 2 comments
Closed

Column with *_id not generating a belongsTo relation anymore. #912

passchn opened this issue Mar 10, 2023 · 2 comments

Comments

@passchn
Copy link
Contributor

passchn commented Mar 10, 2023

Description

I guess this is a feature which was introduced recently. So if you e.g. have a table articles and a field image_id, the generated ArticlesTable no longer has a relation to Images, if there is not actually an images table in the database.

This "bug" was practical for my assets plugin which uses these "fake relations", as described here:
https://github.com/brandcom/cakephp-assets/tree/master#use-alibi-names

Is there any possibility to generate the relation code anyway, e.g. by using a flag when running the command? Could be something like bin/cake bake model users --no-table-check or something like that.

That would be great to opt in into the previous behaviour again.

Bake Version

2.8.2

PHP Version

4.4.11, php 8.1.1

@passchn passchn added the defect label Mar 10, 2023
@passchn
Copy link
Contributor Author

passchn commented Mar 10, 2023

I downgraded to the plugin version 2.6 and these are the code differences after running bin/cake bake model articles again:

Bildschirm­foto 2023-03-10 um 19 41 05

@dereuromark
Copy link
Member

I think you can make a PR that would allow for this.
It is unlikely someone else would come forward in a reasonable time frame for such specific requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants