diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index 8d41e45..e51cf0d 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -661,7 +661,7 @@ protected function preSaveRevision(\stdClass $record, EntityInterface $entity) { */ protected function invokeHook($hook, EntityInterface $entity) { if (!empty($this->entityInfo['fieldable'])) { - $this->configFieldOp($hook, $entity->getNGEntity()); + $this->configFieldOp($hook, $entity->getBCEntity()); } $function = 'field_attach_' . $hook; @@ -682,7 +682,7 @@ protected function invokeHook($hook, EntityInterface $entity) { /** * @todo Temporary, to avoid duplicating code between DSC & DSCNG for now. */ - protected function configFieldOp($hook, EntityNG $entity) { + protected function configFieldOp($hook, EntityInterface $entity) { if (in_array($hook, array('presave', 'insert', 'update', 'delete', 'revision_delete'))) { $method = ($hook == 'revision_delete') ? 'revisionDelete' : $hook; // @todo Check the multilingual logic. Current logic in _field_invoke() @@ -691,9 +691,9 @@ protected function configFieldOp($hook, EntityNG $entity) { // $langcodes = _field_language_suggestion($available_langcodes, NULL, $field_name); // @todo getTranslationLanguages() seems like a potential perf drag ? foreach (array_keys($entity->getTranslationLanguages()) as $langcode) { - $translation = $entity->getTranslation($langcode); - // Temporarily, let Drupal install. - if ($translation) { + // @todo translation not always available ? + // Install fails on user entity and even sending the BCentity doesn't work. + if ($translation = $entity->getTranslation($langcode)) { foreach (array_keys($translation->getPropertyDefinitions()) as $property) { $translation->get($property)->$method(); } diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 31f55d7..b789b90 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -36,6 +36,9 @@ function field_info_cache_clear() { // functions are moved to the entity API. entity_info_cache_clear(); + // Clear typed data definitions. + \Drupal::service('typed_data')->clearCachedDefinitions(); + _field_info_collate_types_reset(); Field::fieldInfo()->flush(); } diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php index cf57104..4b3a04d 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php @@ -444,18 +444,8 @@ public function getSchema() { if (!isset($this->schema)) { // Get the schema from the field item class. $definition = \Drupal::typedData()->getDefinition('field_type:' . $this->type); - // @todo BC layer schema not found, especially during install (image). - if (!empty($definition['class'])) { - $class = $definition['class']; - $schema = $class::schema($this); - } - else { - $module_handler = \Drupal::moduleHandler(); - module_load_install($this->module); - // Invoke hook_field_schema() for the field. - $schema = (array) $module_handler->invoke($this->module, 'field_schema', array($this)); - $schema += array('columns' => array(), 'indexes' => array(), 'foreign keys' => array()); - } + $class = $definition['class']; + $schema = $class::schema($this); // Fill in default values for optional entries. $schema += array('indexes' => array(), 'foreign keys' => array());