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

[5.x] Fix term reference updates after slug change #11058

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from

Conversation

daun
Copy link
Contributor

@daun daun commented Nov 5, 2024

Fix an issue where updating a term's slug through the control panel would not update the references to that term in existing entries, even though system.update_references is enabled.

The root of the issue appears to be that the auto-bound Term instance in the CP controller lacks its original data because there is no initial syncOriginal() call. The first call to syncOriginal happens only after saving, which is not helpful here. I’m not sure why this doesn't also happen with Entries, but it seems to work there.

The existing tests haven't caught this as it only happens in the CP controller, not when creating and updating terms in a test environment. Would love to contribute tests here as well, but that's a bit over my head how to test this reliably across the CP routes/controllers.

Closes #10938

Related: #11021

@daun
Copy link
Contributor Author

daun commented Nov 19, 2024

I've just switched a production site from flat-file to eloquent — the suggested fix in this PR is only required for flat-file data. Terms saved in eloquent seem to trigger a reference update as intended. The good news is that it also doesn't hurt :)

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

Successfully merging this pull request may close these issues.

Updating term slug creates duplicate instead of updating
1 participant