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

[4.x]: Project config applying multi site loses relationships on localize relations enabled fields #12702

Closed
Wiejeben opened this issue Feb 20, 2023 · 6 comments
Assignees

Comments

@Wiejeben
Copy link
Contributor

What happened?

Description

Currently I am working on creating a multi language website from an existing single language website. I setup the fields to have localization enabled and I created a second language website. This all went fine. However when applying the project config to the production database the existing website gets lost (however does exist on the new website)

Trying again on a backup of the database but without the second site being added inside the project config does keep the existing relations on the existing language correctly.

Steps to reproduce

  1. Setup a single locale site
  2. Create a backup from the database
  3. Setup a new locale website
  4. Apply localization to relationship fields
  5. Make sure you have relationships selected in that field
  6. Add the second language
  7. Enable localized relations on the relationship field
  8. Apply the backup to the database
  9. Re-apply the multi-site and localization via project-config/apply

Expected behavior

It to replicate the relationship data to the new website

Actual behavior

Relationship data is lost on the existing site

Craft CMS version

4.3.10

PHP version

8.1.11

Operating system and version

Docker Alpine

Database type and version

MySQL 8.0.28

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-50)

Installed plugins and versions

  • percipioglobal/craft-notifications
  • craftcms/redactor
  • dolphiq/redirect
  • nystudio107/craft-seomatic
  • sebastianlenz/linkfield
  • nystudio107/craft-vite
@i-just
Copy link
Contributor

i-just commented Feb 20, 2023

Hi, thanks for getting in touch. Can you please let me know if I understand the problem correctly?

  • You start with one site: site A. For simplicity, let’s say it has one section, e.g. a channel and one entry type. That entry type has an assets field. You create an entry for this section and populate the assets field with content.
  • You take a backup of the database at this point.
  • You create a second site: site B, edit the assets field, check “Manage relations on a per-site basis”, and save. You edit your section and enable it for site B. What propagation setting have you chosen for this section?
  • You import the backup you’ve taken before creating site B and run project-config/apply.
  • You check the entry, and the asset you selected is there for site B but is now missing for site A?

@Wiejeben
Copy link
Contributor Author

Wiejeben commented Feb 21, 2023

Hi, thanks for getting back so quickly! Yes those steps are exactly right. I think so far this only happens on singles, which do not have any localization configuration apart from enabling it for the new site.

@i-just
Copy link
Contributor

i-just commented Feb 21, 2023

Thanks for confirming and for the additional info. I can replicate it consistently, but only if I edit the entry type for the single after adding the second site and uncheck the ”Show the Title field”. Were you, by any chance doing that as well?

@Wiejeben
Copy link
Contributor Author

Yes the title field is indeed unchecked for the single that is having this issue! Well found

@brandonkelly
Copy link
Member

This is fixed now for the next release, via #12715. Thanks for reporting @Wiejeben!

@brandonkelly
Copy link
Member

Craft 4.3.11 is out with this fix.

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

No branches or pull requests

3 participants