After saving the site settings, I get this error

</br></br><em class="placeholder">Drupal\Core\Entity\EntityStorageException</em>: SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#039;fieldset&#039; cannot be null: INSERT INTO {site_setting_entity_field_data} (id, type, langcode, user_id, name, fieldset, status, created, changed, default_langcode) 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, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array
(
    [:db_insert_placeholder_0] =&gt; 4
    [:db_insert_placeholder_1] =&gt; prices
    [:db_insert_placeholder_2] =&gt; ru
    [:db_insert_placeholder_3] =&gt; 1
    [:db_insert_placeholder_4] =&gt; Prices
    [:db_insert_placeholder_5] =&gt; 
    [:db_insert_placeholder_6] =&gt; 1
    [:db_insert_placeholder_7] =&gt; 1534072424
    [:db_insert_placeholder_8] =&gt; 1534072424
    [:db_insert_placeholder_9] =&gt; 1
)
 in <em class="placeholder">Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;save()</em> (line <em class="placeholder">829</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php</em>).

I tested it on a clean drupal installation and got the same error.
/files/issues/2018-08-12/1.png

/files/issues/2018-08-12/2.png

/files/issues/2018-08-12/3.png

Comments

xdevelx created an issue. See original summary.

xdevelx’s picture

Issue summary: View changes

...

xdevelx’s picture

Issue summary: View changes
xdevelx’s picture

Issue summary: View changes
mr.york’s picture

Missing fieldset.

scott_euser’s picture

Status: Active » Needs review
StatusFileSize
new1 KB

Attached patch should prevent this from happening. Happens when on first site setting creation you don't set a fieldset name.

aludescher’s picture

When adding the first Site Setting type under /admin/structure/site_setting_entity_type/add there is no existing fieldset label and a Create a new "Fieldset Legend" label text field is used but field is not required, i.e. it can be left empty. But in the db schema fieldset cannot be null, thus the error from the OP.

When adding the next Site Setting type there's a Choose existing "Fieldset Legend" label select field which is required. With the -- create a new fieldset -- option it can be saved without entering a fieldset name. Thus you can have any number of site setting types without ever defining a fieldset.

The patch in #6 fixes this using a form validator check. It forces the user to add a fieldset label in the above cases, there's a Please enter a fieldset name. error message after a form submit as long as the fieldset label is empty. I confirm that it works for me.
It might not be the best for UX because the field required message only comes after submitting the form, Making the fieldset label field required when visible might solve this, see https://api.drupal.org/comment/62866#comment-62866

  • scott_euser committed 8ff04cd on 8.x-1.x
    Issue #2992171 by scott_euser, xdevelx: Error Drupal\Core\Entity\...

  • scott_euser committed 8dd654e on 8.x-1.x
    Issue #2992171 by scott_euser, xdevelx, aludescher: Error Drupal\Core\...
scott_euser’s picture

It might not be the best for UX because the field required message only comes after submitting the form, Making the fieldset label field required when visible might solve this, see https://api.drupal.org/comment/62866#comment-62866

Thanks for the tip! Added.

scott_euser’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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