public function write(array $items) { foreach ($items as $product) { $this->productManager->save($product); $this->stepExecution->incrementSummaryInfo('save'); } }
/** * Add attributes to product * * @param Request $request The request object * @param integer $id The product id to which add attributes * * @AclAncestor("pim_enrich_product_add_attribute") * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function addAttributesAction(Request $request, $id) { $product = $this->findProductOr404($id); $availableAttributes = new AvailableAttributes(); $attributesForm = $this->getAvailableAttributesForm($product->getAttributes(), $availableAttributes); $attributesForm->submit($request); $this->productManager->addAttributesToProduct($product, $availableAttributes); $this->productManager->save($product); $this->addFlash('success', 'flash.product.attributes added'); return $this->redirectToRoute('pim_enrich_product_edit', array('id' => $product->getId())); }