--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -164,6 +164,7 @@ public function getConstraints() { ]); } } + return $constraints; } /** --- a/core/modules/field/src/Tests/Update/EntityReferenceTargetBundleUpdateTest.php +++ b/core/modules/field/src/Tests/Update/EntityReferenceTargetBundleUpdateTest.php @@ -7,7 +7,6 @@ namespace Drupal\field\Tests\Update; -use Drupal\field\Entity\FieldStorageConfig; use Drupal\system\Tests\Update\UpdatePathTestBase; /** @@ -32,21 +31,22 @@ protected function setDatabaseDumpFiles() { * @see field_update_8001() */ public function testFieldUpdate8001() { - // Load the 'node.field_tags' field storage, and check it has the legacy - // 'target_bundle' storage setting set to NULL. - /** @var \Drupal\field\FieldStorageConfigInterface */ - $field_storage = FieldStorageConfig::load('node.field_tags'); - $settings = $field_storage->getSettings(); - $this->assertTrue(array_key_exists('target_bundle', $settings)); - $this->assertNull($settings['target_bundle']); + $configFactory = $this->container->get('config.factory'); + + // Add the deprecated 'target_bundle' setting to the 'node.field_tags' field + // storage config. + /** @var \Drupal\Core\Config\Config */ + $config = $configFactory->getEditable('field.storage.node.field_tags'); + $config->set('settings.target_bundle', NULL); + $config->save(TRUE); // Run updates. $this->runUpdates(); - // Load the field storage again, and check the 'target_bundle' setting has - // been removed. - $field_storage = FieldStorageConfig::load('node.field_tags'); - $settings = $field_storage->getSettings(); + // Reload the config, and check that the 'target_bundle' setting has been + // removed. + $config = $configFactory->getEditable('field.storage.node.field_tags'); + $settings = $config->get('settings'); $this->assertFalse(array_key_exists('target_bundle', $settings)); }