From 0667cdb62d20bade02bc3cd5e25549113d4b79b5 Mon Sep 17 00:00:00 2001
From: Bohdan Korablov <bkorablov@magento.com>
Date: Tue, 22 Nov 2016 16:39:41 +0200
Subject: [PATCH] MAGETWO-60908: Image role can't be updated

---
 .../Catalog/Model/Product/Gallery/GalleryManagement.php        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php
index f3b7e166b53..d2a31968685 100644
--- a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php
+++ b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php
@@ -96,8 +96,7 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal
         foreach ($existingMediaGalleryEntries as $key => $existingEntry) {
             $entryTypes = (array)$entry->getTypes();
             $existingEntryTypes = (array)$existingMediaGalleryEntries[$key]->getTypes();
-            $intersectEntryTypes = array_intersect($entryTypes, $existingEntryTypes);
-            $existingMediaGalleryEntries[$key]->setTypes(array_diff($existingEntryTypes, $intersectEntryTypes));
+            $existingMediaGalleryEntries[$key]->setTypes(array_diff($existingEntryTypes, $entryTypes));
 
             if ($existingEntry->getId() == $entry->getId()) {
                 $found = true;
-- 
GitLab