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
Translate behavior issue when model only contains the translated field #9610
Comments
Does the original table contain both the |
Both. |
Based on the referenced lines you're saving a model in a non-default locale as well? |
Nope, in the default locale. |
If it's the default locale, how come there are no dirty fields? The default locale is meant to be saved in the main table |
Double checked, you're right, it's not the default locale. |
Do you mind writing a test case for the core? That would help greatly to investigate the issue |
When we have bundled translations but no changed fields, we need to mark the original fields dirty so we can save the root entity and the attached translations. Refs #9610
Thanks for the test @andrej-griniuk. I've got a pull request up now. |
Fix saving translations when only translations are modified.
This is a (multiple allowed):
What you did
Create a table with only 2 fields. Let's say countries [id, name]. Bake everything. Add Translate behaviour
$this->addBehavior('Translate', ['fields' => ['name']]);
to the Table anduse TranslateTrait;
to the Entity. Go tocountries/add
and try to add a new Country with name "USA".Expected Behavior
New country created in countries table with "USA" name in the i18n table.
Actual Behavior
"The country could not be saved. Please, try again.". If inspect $country in the controller - no errors there.
The text was updated successfully, but these errors were encountered: