While importing the content with paragraph fields I came across the error:
Drupal\Core\Entity\EntityStorageException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 783 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
The error occurs either on importing a new paragraph (to replicate: create the content -> export -> delete the content -> import) or importing the paragraphs over existing ones.
The error is connected to 'behavior_settings' field which stores its values in a database as a serialized array. Unserialization happens in Drupal core - Drupal\serialization\Normalizer\PrimitiveDataNormalizer->normalize() explicitly unserialized such fields. Without the patch, it tries to save the array instead of a serialized string. The patch forces it to serialize the value before importing.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | content_sync-paragraph_behavior_settings-4-D8.patch | 1.96 KB | klimp |
Comments
Comment #2
klimpComment #3
klimpComment #4
klimpA better implementation. Now every entity being exported is getting processed by a method checking if there any fields to be serialized.
Comment #5
klimpComment #6
klimpComment #7
asterovim commentedThe patch content_sync-paragraph_behavior_settings-4-D8.patch work's perfectly. Thanks you.
Comment #8
blanca.esqueda commentedThanks, @klimp!
The patch will be added to 8.x-2.x-dev
Comment #10
blanca.esqueda commented