コード例 #1
0
 /**
  * Find common attributes
  * Common attributes are:
  *   - not unique (and not identifier)
  *   - without value AND link to family
  *   - with value
  *
  * @param ProductInterface[] $products
  *
  * @return AttributeInterface[]
  */
 public function findCommonAttributes(array $products)
 {
     $productIds = [];
     foreach ($products as $product) {
         $productIds[] = $product->getId();
     }
     $attributeIds = $this->massActionRepository->findCommonAttributeIds($productIds);
     return $this->attributeRepository->findWithGroups(array_unique($attributeIds), ['conditions' => ['unique' => 0]]);
 }
コード例 #2
0
 /**
  * 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;
 }