/** * 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]]); }
/** * Find common attributes * Common attributes are: * - not unique (and not identifier) * - without value AND link to family * - with value * * @param array $productIds * * @return \Pim\Bundle\CatalogBundle\Model\AbstractAttribute[] */ public function findCommonAttributes(array $productIds) { $attributeIds = $this->massActionRepository->findCommonAttributeIds($productIds); return $this->attributeRepository->findWithGroups(array_unique($attributeIds), array('conditions' => ['unique' => 0])); }