In Gallery Item was add the additional field with type "Entity Reference". When I change this field on tab "Managed Item" and try to save, I get the exception
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_instructor_target_id' cannot be null: INSERT INTO {field_data_field_instructor} (entity_type, entity_id, revision_id, bundle, delta, language, field_instructor_target_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 113 [:db_insert_placeholder_2] => 113 [:db_insert_placeholder_3] => node_gallery_item [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 451 of /home/u329254/dive.whoop.ru/www/modules/field/modules/field_sql_storage/field_sql_storage.module).
I've tried to use another type of field (eg. text) and it works fine.

Comments

IRONFELIX’s picture

The result of debbuging:
file: node_gallery_api.inc
function: node_gallery_api_batch_node_save($nodes, &$context)
I received in function NULL value for array element $nodes->['field_reference'][0]['target_id'] instead of NULL array $nodes->['field_reference']

hyltonmillar’s picture

This works fine if the field is required. The problem is when "none" is selected. node_save then has an error because of the null in target_id.