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

Craft 4 - Integrity violation after saving entry with link field #219

Open
Antimated opened this issue May 5, 2022 · 6 comments
Open

Craft 4 - Integrity violation after saving entry with link field #219

Antimated opened this issue May 5, 2022 · 6 comments
Labels

Comments

@Antimated
Copy link

Antimated commented May 5, 2022

Trying to save a link field (on an existing craft install that's been updated to craftcms 4.0.0.1) results in a integrity violation error. This error occurs mostly when switching from/to different link types. In my case the error occurs inside of a matrix field, not sure if it's also the case when the field is just plain added to an entry.

Plugin version: 2.1.1-rc

Screenshot 2022-05-05 at 15 05 01

@Antimated Antimated changed the title Craft 4 - Integrity violation after saving entry with link field (in matrix) Craft 4 - Integrity violation after saving entry with link field May 5, 2022
@sebastian-lenz
Copy link
Owner

sebastian-lenz commented May 5, 2022

The error does not contain a reference to a link field, also the affected table is not the link field table. Why do you assume that error is related to this plugin?

@Antimated
Copy link
Author

Antimated commented May 5, 2022

The error does not contain a reference to a link field, also the affected table is not the link field table. Why do you assume that error is related to this plugin?

Because whenever I update this field the error occurs :/ Seems like switching options in the dropdown (where you have: "no link", entry, custom,...) and then saving throws me the error. Does not happen (as far as I can reproduce) when changing other fields)

@Antimated
Copy link
Author

Antimated commented May 5, 2022

I'm also not able to select an entry from a typed link field, just gives a server error.

@sebastian-lenz
Copy link
Owner

I've received another issue from a user who also complains about a similar foreign key issue, I guess the new CMS version exposes issues within the data structure of certain projects. In you example, the database complains about an element with the id 166 not being present in the table craft_elements. Can you check whether the element record is there? Also, does the element select dialog work in other instances, e.g. for reference fields?

@Antimated
Copy link
Author

Antimated commented May 5, 2022

I've received another issue from a user who also complains about a similar foreign key issue, I guess the new CMS version exposes issues within the data structure of certain projects. In you example, the database complains about an element with the id 166 not being present in the table craft_elements. Can you check whether the element record is there?

No, doesn't seem like that element is present for some reason...
Screenshot 2022-05-05 at 15 42 09

Also, does the element select dialog work in other instances, e.g. for reference fields?

Yes I added a simple "entries" field with these sources (it's a relatively empty site) and the element select dialog seems to work there.

Screenshot 2022-05-05 at 15 44 42

Maybe an extra sidenote: This is a multi language site

@sebastian-lenz
Copy link
Owner

Okay, I think I've found the bug, it's related to the way Craft now handles newly created elements. I've published a new release that contains the fix.

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

No branches or pull requests

2 participants