Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / migrate / src / Plugin / migrate / destination / EntityContentBase.php
index d4f9bd72ecc5dff1d86ccefeb1160f8a7481241e..cf3ae1dedb79e8cf6c83384b4f707e58888fb497 100644 (file)
@@ -149,6 +149,7 @@ class EntityContentBase extends Entity {
    *   An updated entity, or NULL if it's the same as the one passed in.
    */
   protected function updateEntity(EntityInterface $entity, Row $row) {
+    $empty_destinations = $row->getEmptyDestinationProperties();
     // By default, an update will be preserved.
     $rollback_action = MigrateIdMapInterface::ROLLBACK_PRESERVE;
 
@@ -171,6 +172,7 @@ class EntityContentBase extends Entity {
     // clone the row with an empty set of destination values, and re-add only
     // the specified properties.
     if (isset($this->configuration['overwrite_properties'])) {
+      $empty_destinations = array_intersect($empty_destinations, $this->configuration['overwrite_properties']);
       $clone = $row->cloneWithoutDestination();
       foreach ($this->configuration['overwrite_properties'] as $property) {
         $clone->setDestinationProperty($property, $row->getDestinationProperty($property));
@@ -184,6 +186,9 @@ class EntityContentBase extends Entity {
         $field->setValue($values);
       }
     }
+    foreach ($empty_destinations as $field_name) {
+      $entity->$field_name = NULL;
+    }
 
     $this->setRollbackAction($row->getIdMap(), $rollback_action);