/** * 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::allAtributes with values from the repository * * @return array */ public function getAllAttributes() { if (null === $this->allAttributes) { $locale = $this->getLocale()->getCode(); $allAttributes = $this->attributeRepository->findWithGroups([], ['conditions' => ['unique' => 0]]); foreach ($allAttributes as $attribute) { $attribute->setLocale($locale); $attribute->getGroup()->setLocale($locale); } $allAttributes = $this->massActionManager->filterLocaleSpecificAttributes($allAttributes, $locale); $this->allAttributes = $allAttributes; } return $this->allAttributes; }