I have an use case where I have added fields to a relation and set field permissions on them. The field permissions work correctly in a way that the fields are not displayed with relation select for a user that doesn't have the rights. However when a user that doesn't have rights to the fields of relation tries to save only the relation he sees, the save fails with a fatal error:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_abcd_wins_value' at row 1: INSERT INTO {field_data_field_abcd_wins} (entity_type, entity_id, revision_id, bundle, delta, language, field_abcd_wins_value) 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] => relation [:db_insert_placeholder_1] => 27 [:db_insert_placeholder_2] => 117 [:db_insert_placeholder_3] => team_to_league [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of modules/field_sql_storage/field_sql_storage.module).
This could be solved by fixing the actual saving of fields but also by removing the fields altogether. I want to use the relation select just for selecting relations, and not entering field values most of the time anyways.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | relation_select-add_option_for_fields-1824680-1.patch | 1.33 KB | kimwes |
Comments
Comment #1
kimwes commentedHere's a patch to add option to hide relation fields from relation select. The option is on by default to preserve past behaviour.
Comment #2
kimwes commentedNeed review not work... or at least for now ;)
Comment #3
steveoliver commentedIt seems this could cause problems with *required relation fields.
Comment #4
nwom commented