-
Notifications
You must be signed in to change notification settings - Fork 635
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
[5.x]: fields/merge asset fields merges selected assets #15869
Comments
Experiencing the same thing here |
I’m able to reproduce this, and looking into how we can guard against it, but for now: the way to work around this is to run the appropriate For example if both of the to-be-merged relation fields are used by a php craft resave/entries --type=foo (This should be done on all environments, before the merge/before the changes get deployed to them.) |
Made some changes for Craft 5.5 which will help avoid this issue: (571c620)
|
@brandonkelly Is it sufficient to run |
@mihob Yep, just make sure to run it on all environments. |
Craft 5.5.0 is out with those changes 🎉 |
What happened?
Description
When running
fields/auto-merge
and merging two asset fields which are part of the same entry-type, their content relations are merged into the persisting field.I have an entry type
doubleImageSection
(former matrix block) which had fields calledleftImage
andrightImage
. I took a screenshot of thefields/auto-merge
output as a todo list for later:Example
Before the field merge, the
doubleImageSection
entry type was used in a matrix field and the two fields had one image each:After running the merge command, I ended up with the persisting
leftImage
field holding both of the images:Max-relations ignored
Note that I had max relations set to
1
for both original fields, a setting which persisted as expected, so validation fails and saving the entry is not possible without manually fixing the issue.Project config
The result of the merge command looks okay:
Migration file rightImage_into_leftImage:
Config file for doubleImageSection entry type:
Steps to reproduce
I rolled back to before the merge and can confirm that this happened with the auto-merge command, not with the Craft 4 to 5 upgrade itself:
leftImage
andrightImage
, max relations set to1
leftImage
Expected behavior
leftImage
asset field, but one with field handle overriderightImage
Actual behavior
leftImage
asset field, but one with field handle overriderightImage
leftImage
, no asset inrightImage
Possible explanation
Could the source be that the field handle override of the non-persisting field is ignored when running the content migration, and instead the content migration merges the content of both fields into the field based on the original field handle (now
leftImage
for both field instances)?Craft CMS version
5.4.6
PHP version
8.2.24
Operating system and version
Darwin 23.3.0
Database type and version
MySQL 8.0.27
Image driver and version
Imagick 3.7.0 (ImageMagick 7.1.1-38)
Installed plugins and versions
AsyncQueue 4.0.0
Contact Form 3.1.0
Contact Form Extensions 5.0.0
Contact Form Honeypot 2.1.0
Craft Commerce 5.1.3
Dumper 5.0.1
Knock Knock 3.0.1
PayPal Checkout for Craft Commerce 3.0.1
Redactor 4.2.0
Vite 5.0.1
The text was updated successfully, but these errors were encountered: