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

Revisions don't seem to work with paragraphs #31

Closed
laryn opened this issue Jan 31, 2019 · 13 comments · Fixed by #49
Closed

Revisions don't seem to work with paragraphs #31

laryn opened this issue Jan 31, 2019 · 13 comments · Fixed by #49

Comments

@laryn
Copy link
Member

laryn commented Jan 31, 2019

Haven't done any further testing yet but I see this when trying to save a revision on a node that has paragraphs field:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY': INSERT INTO {paragraphs_item_revision} (revision_id, item_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 ) in backdrop_write_record() (line 8086 of /path/core/includes/common.inc).

EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in ParagraphsItemController->save() (line 55 of /path/modules/paragraphs/ParagraphsItemController.inc).

EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in NodeStorageController->save() (line 320 of /path/core/modules/node/node.entity.inc).

@laryn laryn added the bug Something isn't working label Jan 31, 2019
@sternhagel
Copy link

I can confirm this issue. I'm seeing similar error messages when trying to save a revision of a node with paragraphs on it:

EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6' for key 'PRIMARY' in NodeStorageController->save() (line 487 of [...]/core/modules/node/node.entity.inc).
EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6' for key 'PRIMARY' in ParagraphsItemController->save() (line 55 of [...]/modules/paragraphs/ParagraphsItemController.inc).

@laryn
Copy link
Member Author

laryn commented Dec 4, 2019

Likely related to:

Which is waiting on a decision about core. It seems as though there is some interest in moving entity revision functions into core, though PR needs work:

@laryn
Copy link
Member Author

laryn commented Dec 12, 2019

Cross post:


I made a new branch for testing, which adds a dependency on Entity Plus (although it requires this PR on Entity Plus: https://github.com/backdrop-contrib/entity_plus/pull/16/files). Revisions with Paragraph fields are working for me using this branch. Anybody care to test?

https://github.com/backdrop-contrib/paragraphs/compare/entityplus

If Entity Revision functions get into core we may not need to keep the Entity Plus dependency, but will need to test obviously.

@laryn laryn added the has pr Has a PR or branch for testing. label Dec 13, 2019
@sternhagel
Copy link

@laryn Tested this issue as well with entityplus branch and PR on "Entity Plus" module - works perfectly!

@sternhagel
Copy link

After more testing I got the following PHP notice after reverting a node to any revision - it's not coming from Paragraphs module directly, but it's probably related:

Notice: Undefined property: ParagraphsItemEntity::$original in file_field_update() (line 267 of [...]/core/modules/file/file.field.inc).

@laryn
Copy link
Member Author

laryn commented Dec 17, 2019

@sternhagel I broke that last one out into a separate issue since it seems to happen more broadly on save/updating an entity that has a Paragraphs file field attached.

@bradbulger
Copy link
Contributor

I tried using the entityplus branch. That gave me fatal errors until I also patched entity_plus for some unfixed bugs. Having done that, I was able to save a new revision of the node.

What are the obstacles to getting these modules fixed? Do tests need to be written? Do we need to resolve the issue of entity_plus vs core?

@laryn
Copy link
Member Author

laryn commented Feb 8, 2020

Did you use the PR I linked for entity plus?
I think @docwilmot was open to making me a maintainer in entity plus, at which point I will merge that PR and be clear to make a new release here.

If you didn't use the PR on entity plus, did you have additional changes or patches to add?

@bradbulger
Copy link
Contributor

I ended up using the PR and then read more carefully your note telling us to do that, d'oh. So I think I was on the configuration you were aiming at - the entityplus branch of paragraphs + the entity_plus pull request 16. The errors on saving a node with "new revisions by default" enabled went away. I didn't try anything more extensive than that.

@bradbulger
Copy link
Contributor

Running the entityplus branch with the 1.0.4 release of entity_plus, I am able to add and remove paragraphs and save the node with revisions enabled, without error. Using the diff module I'm able to see differences in the paragraphs for the node between revisions.

@laryn laryn linked a pull request Mar 6, 2020 that will close this issue
@laryn laryn closed this as completed in #49 Mar 6, 2020
@jackaponte
Copy link
Member

Any chance of a new release sometime soon? This particular bug is biting me lately! If not I'll try to create a patch for myself soon. :)

@laryn
Copy link
Member Author

laryn commented Jun 5, 2020

@jackaponte Here's a pre-release:
https://github.com/backdrop-contrib/paragraphs/releases/tag/1.x-1.1.0-beta

@laryn laryn removed bug Something isn't working has pr Has a PR or branch for testing. labels Jun 5, 2020
@jackaponte
Copy link
Member

@jackaponte Here's a pre-release:
https://github.com/backdrop-contrib/paragraphs/releases/tag/1.x-1.1.0-beta

Awesome, thanks so much @laryn!

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 a pull request may close this issue.

4 participants