Problem/Motivation
aving a flipbook entity can fail with a DB integrity error when flipbook_cover is present but its width/height values are empty.
Observed error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'flipbook_cover__width' cannot be null
This happens on entity save/update when the image field item is written without dimensions.k
Steps to reproduce
nstall and enable flipbook (11.0.1) on Drupal 10/11.
Load an existing flipbook entity with a flipbook_cover target file.
Save the entity with a flipbook_cover item that includes target_id but no explicit width/height values.
Save fails with flipbook_cover__width / flipbook_cover__height null constraint violation.
Proposed resolution
Add a preSave() safeguard in Flipbook entity class:
If flipbook_cover exists and dimensions are missing:
Try to compute width/height from the referenced file via image.factory.
If dimensions still cannot be determined, set safe fallback values (0/0) to avoid SQL NOT NULL failure.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal-flipbook-10.0.1-fix-null-cover-dimensions.patch | 1.36 KB | betoaveiga |
| #2 | drupal-flipbook-fix-null-cover-dimensions-11.0.1.patch | 1.56 KB | betoaveiga |
Comments
Comment #2
betoaveigaThese are patches I created with AI to fix the issue when saving flipbook entities.
These patches are for versions 11.0.1 and 10.0.1
Comment #3
betoaveigaComment #4
kushal bansal commentedThanks betoaveiga for looking into it. I will test this patch and see how it goes.