/** * {@inheritdoc} */ public function addMissingAssociations(ProductInterface $product) { $missingAssocTypes = $this->assocTypeRepository->findMissingAssociationTypes($product); if (!empty($missingAssocTypes)) { foreach ($missingAssocTypes as $associationType) { $association = new $this->associationClass(); $association->setAssociationType($associationType); $product->addAssociation($association); } } return $this; }