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

ignore shadow translations tables *_translations #1020

Merged
merged 1 commit into from
Nov 29, 2024
Merged

ignore shadow translations tables *_translations #1020

merged 1 commit into from
Nov 29, 2024

Conversation

dereuromark
Copy link
Member

Resolves #1011

We probably want to document that we cannot bake any actual tables anymore that would end this way.
I have for example
https://github.com/dereuromark/cakephp-translate/blob/734d8610e6de7b81878052546890a55662e52eda/config/Migrations/20170414190437_TranslateCache.php#L11
which would then not work anymore.

Is there a way we could be more specific maybe?
Intospecting the table schema to see if it matches a shadow table schema might be overkill, no?

@ADmad
Copy link
Member

ADmad commented Nov 29, 2024

Intospecting the table schema to see if it matches a shadow table schema might be overkill, no?

It would be a foolproof way though as shadow tables have a multicolumn PK with a locale column.

Another simpler option would be to check if a matching table without the _translations suffix also exists.

@dereuromark
Copy link
Member Author

Either way, then the regexp and $ignore seems not to cover it anymore here.
I made its own method now.

Copy link
Member

@ADmad ADmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized something. Skipping the shadow tables should be done in the ModelAllCommand, not the TableScanner.

I have my own customized model command where I check if the tables list returned by the TableScanner has a matching shadow table for a table and add the Translate behavior for it. So removing these tables from the tables list itself will break that feature.

@dereuromark
Copy link
Member Author

Better?

@dereuromark
Copy link
Member Author

However, it would still bake

  • Table
  • Entity
  • Controller
  • ...

when running through "bake all --everything" etc
so this then needs to be duplicated across mutliple ones :/

@ADmad
Copy link
Member

ADmad commented Nov 29, 2024

In that case keep the removeShadowTranslationTables() in TableScanner itself but call in from ModelAllCommand, ControllerAllCommand and AllCommand?

@dereuromark
Copy link
Member Author

Now it works properly 🎉

@markstory markstory merged commit f615076 into 3.x Nov 29, 2024
8 of 9 checks passed
@markstory markstory deleted the 3.x-i18n branch November 29, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skip table class generation for *_translations table.
3 participants