Using bulk edit form with entity reference revisions creates a single entity, shared by all content being edited

Created on 27 September 2019, about 5 years ago
Updated 14 March 2023, almost 2 years ago

Scenario:
- Node type with Paragraphs entity reference revisions field, e.g. "Blog Post" node with "Pull Quote" field
- Bulkedit view that allows creating paragraph
- Add a "pull quote" paragraph to 2 or more blog posts

Expected:
- One paragraph entity will be created for each blog post node being edited

Observed:
- A single paragraph will be created, sharing a reference from every edited blog post

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada adam-vessey PE, Canada

    Things are not mergeable as-is, as #3173187: Make VBO an optional dependency β†’ / https://git.drupalcode.org/project/views_bulk_edit/-/commit/55f630241d71... moved the code in question.

    Got looking into this, as we have run into issues when attempting to manipulate replace/add a number of paragraph entities greater than the batch size, and encountering SQL exceptions (using PostgreSQL... is MySQL less severe with "unique" collisions?). Exception as such:

    Drupal\Core\Entity\EntityStorageException: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "paragraphs_item__paragraph_field__uuid__value__key" DETAIL: Key (uuid)=(69262fed-58ba-4021-8a2f-edebfbd7befa) already exists.: INSERT INTO "paragraphs_item" ("revision_id", "type", "uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3) RETURNING id; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /opt/www/drupal/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
    

    This would only pop when going to process the first item in the second batch of items.

  • Status changed to Needs review almost 2 years ago
  • πŸ‡¨πŸ‡¦Canada adam-vessey PE, Canada

    Actually, scratch that, I was looking just at the patch, not the code in fork. Having taken a quick look at the fork, I thought the fork's claiming that it still had to be rebased was the same thing, but it _does_ actually target the BulkEditFormTrait.

  • πŸ‡¨πŸ‡¦Canada adam-vessey PE, Canada

    Just hiding the patch, as it's cannot presently be applied.

  • πŸ‡¨πŸ‡¦Canada adam-vessey PE, Canada

    Hit the "rebase" button on the MR, to deal with that for now.

    The MR seems to do the trick to deal with my "unique violation" exception; however, holding off on swapping the status to RTBC as it does not quite match the original described scenario; though, might only be a slight alteration:

    To the "Scenario", making the view process batch-wise, processing a single item per batch ("Process in a batch operation" checked, and "Batch size" of 1; I could not get this to happen when _not_ processing in a batch)

    And for "Observed", unique paragraphs being created for all items in the first batch set, but then the "unique violation" exception being thrown adding to the first item in the second batch set (the "batch size + 1"th item).

    Seems to suggest something being serialized in the batch state that possibly/probably shouldn't be, but the ::createDuplicate/clone procedure deals with it.

  • πŸ‡¦πŸ‡ΊAustralia jaydee1818 Melbourne

    MR works for me. Cheers.

Production build 0.71.5 2024