/**
  * Generate common attributes
  * @param array  $products
  * @param string $locale
  *
  * @return AttributeInterface[]
  */
 protected function generateCommonAttributes(array $products, $locale)
 {
     $commonAttributes = $this->massActionManager->findCommonAttributes($products);
     foreach ($commonAttributes as $attribute) {
         $attribute->setLocale($locale);
         $attribute->getGroup()->setLocale($locale);
     }
     $commonAttributes = $this->massActionManager->filterLocaleSpecificAttributes($commonAttributes, $locale);
     $commonAttributes = $this->massActionManager->filterAttributesComingFromVariant($commonAttributes, $products);
     return $commonAttributes;
 }
 /**
  * Initializes self::commonAtributes with values from the repository
  * Attribute is not available for mass editing if:
  *   - it is an identifier
  *   - it is unique
  *   - without value AND not link to family
  *   - is not common to every products
  *
  * @param array $productIds
  */
 protected function initializeCommonAttributes(array $productIds)
 {
     // Set attribute options locale
     $currentLocaleCode = $this->getLocale()->getCode();
     $this->catalogContext->setLocaleCode($currentLocaleCode);
     // Get common attributes
     $attributes = $this->massActionManager->findCommonAttributes($productIds);
     foreach ($attributes as $attribute) {
         $attribute->setLocale($currentLocaleCode);
         $attribute->getGroup()->setLocale($currentLocaleCode);
         $this->commonAttributes[] = $attribute;
     }
 }