ytgov / yukon-ca

New version of Yukon.ca, built on Drupal 10
1 stars 1 forks source link

Config import error from BaseFieldOverride #481

Open leeomara opened 2 weeks ago

leeomara commented 2 weeks ago

When trying to import config in a new site, I get this error:

 [error]  TypeError: Drupal\Core\Entity\ContentEntityStorageBase::onFieldDefinitionUpdate(): 
Argument #2 ($original) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given, 
called in .../docroot/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php on line 210 
in Drupal\Core\Entity\ContentEntityStorageBase->onFieldDefinitionUpdate() (line 546 of 
.../docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php) 
#0 .../docroot/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php(210): 
Drupal\Core\Entity\ContentEntityStorageBase->onFieldDefinitionUpdate(Object(Drupal\Core\Field\Entity\BaseFieldOverride), NULL)

This patch, https://www.drupal.org/files/issues/2019-12-24/2321071-39.patch from BaseFieldOverride fails to take into account ContentEntityInterface::bundleFieldDefinitions() when invoking onFieldDefinitionUpdate() seems to fix the problem.

leeomara commented 2 weeks ago

Using this patch, the process looks like:

Grab a patch

curl -O https://www.drupal.org/files/issues/2019-12-24/2321071-39.patch

Apply that patch

patch -p2 -d 'docroot/core' < 2321071-39.patch 
$ curl -O https://www.drupal.org/files/issues/2019-12-24/2321071-39.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5336  100  5336    0     0  29644      0 --:--:-- --:--:-- --:--:-- 29480
$ patch -p2 -d 'docroot/core' < 2321071-39.patch 
patching file lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
Hunk #1 succeeded at 114 (offset 5 lines).
Hunk #2 succeeded at 174 (offset 5 lines).
Hunk #3 succeeded at 216 (offset 5 lines).
Hunk #4 succeeded at 236 (offset 5 lines).
patching file lib/Drupal/Core/Field/FieldConfigBase.php
Hunk #1 succeeded at 289 (offset 3 lines).
$ 

Then config import

drush config:import --yes

Then config import again (yes again)

drush config:import --yes

First run failed with this error:

[error]  TypeError: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): Argument #1 
($object) must be of type object, null given in 
Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash() (line 87 of /
var/www/yukon-ca-d10/docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php) 
#0 [internal function]: Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash()

Second run completed successfully.

leeomara commented 2 weeks ago

I'd like this patch included as part of Composer install.