diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 3c8f087..d8e2ed5 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -402,6 +402,11 @@ public function save(EntityInterface $entity) { $this->configFactory->rename($prefix . $id, $prefix . $entity->id()); } + // Build an ID if none is set. + if (!isset($entity->{$this->idKey})) { + $entity->{$this->idKey} = $entity->id(); + } + $entity->preSave($this); $this->invokeHook('presave', $entity); diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 99008e2..6a1c9de 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -121,17 +121,6 @@ public function id() { /** * {@inheritdoc} */ - public function save() { - // Build an ID if none is set. - if (empty($this->id)) { - $this->id = $this->id(); - } - return parent::save(); - } - - /** - * {@inheritdoc} - */ public function getExportProperties() { $names = array( 'id', diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php index 5fbfe65..91455cb 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php @@ -360,11 +360,8 @@ protected function saveNew() { throw new FieldException(format_string('Attempt to create an instance of field @field_id on forbidden entity type @entity_type.', array('@field_id' => $this->field->id, '@entity_type' => $this->entity_type))); } - // Assign the ID. - $this->id = $this->id(); - // Ensure the field instance is unique within the bundle. - if ($prior_instance = $instance_controller->load($this->id)) { + if ($prior_instance = $instance_controller->load($this->id())) { throw new FieldException(format_string('Attempt to create an instance of field @field_id on bundle @bundle that already has an instance of that field.', array('@field_id' => $this->field->id, '@bundle' => $this->bundle))); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php b/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php index d9f369f..4d6245a 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php +++ b/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php @@ -149,17 +149,6 @@ public function id() { /** * {@inheritdoc} */ - public function save() { - // Build an ID if none is set. - if (empty($this->id)) { - $this->id = $this->id(); - } - return parent::save(); - } - - /** - * {@inheritdoc} - */ public function getExportProperties() { $names = array( 'id',