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

Add element check for (global set) project config sync #5257

Closed
joshuabaker opened this issue Nov 21, 2019 · 1 comment
Closed

Add element check for (global set) project config sync #5257

joshuabaker opened this issue Nov 21, 2019 · 1 comment
Assignees
Labels
bug project config 🐫 features related to Project config severity:normal Bugs that affect typical usage

Comments

@joshuabaker
Copy link
Contributor

What happened

Project config sync failed to create a global set fully, setting the ID to a random element.

Why it happened

A field plugin threw an exception (during validation) inside the associated fieldset, which meant that the element save failed. This meant there was no ID for the globalset sync (below). The default globalset table auto increment was used, which caused an invalid reference to an element with the same ID.

$elementsService->saveElement($element, false);
// Save the volume
$globalSetRecord->id = $element->id;
$globalSetRecord->save(false);

How to fix it

I think we should introduce a check here to ensure that the element is saved.

$success = $elementsService->saveElement($element, false);

if (!$success) {
   throw new Exception('Could not save element when syncing global set.');
}

$globalSetRecord->id = $element->id;

Without looking, I suspect that this applies more broadly to project config syncing. This could’ve been rather messy had we not tested this a few times locally.

@andris-sevcenko andris-sevcenko self-assigned this Nov 21, 2019
@andris-sevcenko andris-sevcenko added bug project config 🐫 features related to Project config severity:normal Bugs that affect typical usage labels Nov 21, 2019
@andris-sevcenko
Copy link
Contributor

Thanks for the tip! Fixed for the next release that should be out today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug project config 🐫 features related to Project config severity:normal Bugs that affect typical usage
Projects
None yet
Development

No branches or pull requests

2 participants