Problem/Motivation
User with Moderator permissions has no access to the site and gets PHP errors:
Warning: Undefined array key " moderation_state" in Drupal\Core\Field\Entity\BaseFieldOverride->getBaseFieldDefinition()
Error: Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition()
Steps to reproduce
I was asked to upgrade a site with Drupal core 8.8 to Drupal 10. I am currently at the intermediary state with core Drupal core 9.5 and am hoping to proceed with further upgrades over the next days.
The Administrator role has no issues with acces. However, the user with Moderator permissions has no access to the site and gets two consequtive PHP errors:
1.
Warning: Undefined array key " moderation_state" in Drupal\Core\Field\Entity\BaseFieldOverride->getBaseFieldDefinition() (line 165 of /home/foosite/foosite.com/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php)
The line 165 of /home/foosite/foosite.com/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php is as follows:
/**
* Gets the base field definition.
*
* @return \Drupal\Core\Field\BaseFieldDefinition
*/
protected function getBaseFieldDefinition() {
if (!isset($this->baseFieldDefinition)) {
$fields = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($this->entity_type);
$this->baseFieldDefinition = $fields[$this->getName()];
}
return $this->baseFieldDefinition;
}
2.
Error: Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() (line 112 of /home/foosite/foosite.com/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php)
The line 112 of /home/foosite/foosite.com/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php is as follows:
**
* {@inheritdoc}
*/
public function getFieldStorageDefinition() {
return $this->getBaseFieldDefinition()->getFieldStorageDefinition();
}
Please advise.