I was receiving strict warning errors and applied the patch in https://www.drupal.org/node/1988250, which almost solved my problem. However, in cases where we have no view modes panelized (save for Full Page Override), I would get a few errors like "Warning: Creating default object from empty value in PanelizerEntityDefault->hook_entity_update()" ultimately resulting in a PDOException:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'did' doesn't have a default value: INSERT INTO {panelizer_entity} (entity_type, entity_id, revision_id, view_mode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3)

I attached a patch that addresses this by skipping empty $panelizer variables in hook_entity_update().

I've rolled the attached patch against 7.x-3.1 (the version I'm using), but the issue appears to persist in the dev branch as well. I'm happy to re-roll against 7.x-3.x if you'd like.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gustavderdrache created an issue. See original summary.

gustavderdrache’s picture

FileSize
1.03 KB

Update: I forgot about hook_entity_insert().

DamienMcKenna’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2675766-panelizer-empty-records.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 2675766-panelizer-empty-records.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
1.05 KB

Rerolled.

DamienMcKenna’s picture

I wonder if the changes to hook_entity_update() should delete any matching {panelizer_entity} records? Hrm..

DamienMcKenna’s picture

FileSize
1.05 KB

This deletes any {panelizer_entity} records that match the empty view mode for that entity / revision.

DamienMcKenna’s picture

Oh no, I uploaded the wrong patch and then reverted the changes locally. Gah.

DamienMcKenna’s picture

FileSize
2.08 KB

I was able to recover the lost changes, yay for never closing tabs ;-)

DamienMcKenna’s picture

Lets go with the patch from #8 and punt the cleanup to #2756699: Cleanup data during hook_entity_update() if $entity->panelizer is empty.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.