We have a failing test in Devel Generate: http://qa.drupal.org/pifr/test/137984

Marking critical because it blocks testing.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Assigned: Unassigned » pcambra
pcambra’s picture

Title: Failing test » Devel generate fails when generating comments

Identified the issue when you set comments for content.

Drupal\Core\Entity\EntityStorageException: Unable to set a value with a non-numeric delta in a list. in Drupal\Core\Entity\DatabaseStorageControllerNG->save() (line 342 of /webs/contrib/drupal8/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php).

pcambra’s picture

Status: Active » Needs review
FileSize
1.83 KB

Looking to this closer it seems to me we're in the middle of a big entity conversion, being users and nodes treated in a different way that the rest of entities, found this class "EntityBCDecorator" that nodes are using and it seems it will eventually go away. Users seem to share the same pattern.

Comments, and other entities are treated the "right" way. See below.

Old fashioned way:
$object->{$field_name}[$language->langcode] = $object_field;
New way
$object->{$field_name}->value = $value;

Here's a patch covering both ways, not pretty, but I think there's little we can do short term for this and we need the tests back in green.

salvis’s picture

Thank you for investigating and fixing!

I don't have time to review this properly now and no one else has jumped in, but since we're currently broken, we can only get better. :-)

Please push your patch and trigger a re-test of HEAD.

(The patch has no chance to turn green — that's OK in this exceptional situation.)

amateescu’s picture

FileSize
1.06 KB

This one should be cleaner :)

pcambra’s picture

Status: Needs review » Fixed

Amazing Andrei, thanks a lot

Status: Fixed » Closed (fixed)

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

forestmars’s picture

Issue summary: View changes

Before opening a new issue thought I would check in here. Current version of Devel can't generate articles and is returning the following error:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comment_status' cannot be null: INSERT INTO {node__comment} (entity_id, revision_id, bundle, delta, langcode, comment_status) 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); Array ( [:db_insert_placeholder_0] => 14 [:db_insert_placeholder_1] => 14 [:db_insert_placeholder_2] => article [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 934 of /Users/forestmars/ht/Drupal/d8b7/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

This exception is thrown regardless whether number of comments is set to 0 or not, and regardless whether comments are set to closed on article content type.