Imported image roles are lost on update in Magento 2
  
 
     
     
             
                 
 
 
         
         2 
         
 
         
             
         
 
 
 
 
             
 
             
 
     
 
 I use an import script to create products with associated images that are assigned to roles thumbnail  and small image .   It works well, products and images are imported and they display as thumbnail  and small image  on the front-end website.   But when I try to edit one of those products via Magento admin, the roles thumbnail  and small image  are not selected in the UI and saving the product will make this image's roles to be lost.   Why may cause effective thumbnail  to not be detected as one when loading the Edit  product page? Did I do something the bad way in this import script?   Any clue of what the source of this problem can be?   Here is the import code:       $product->setMediaGallery(array(                                    'images' => array(),                                    'va...