/** * Add attributes to a group * * @param Request $request The request object * @param int $id The group id to add attributes to * * @AclAncestor("pim_enrich_attributegroup_add_attribute") * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function addAttributesAction(Request $request, $id) { $group = $this->findAttributeGroupOr404($id); $availableAttributes = new AvailableAttributes(); $attributesForm = $this->getAvailableAttributesForm($this->getGroupedAttributes(), $availableAttributes); $attributesForm->submit($request); $this->manager->addAttributes($group, $availableAttributes->getAttributes()); $this->addFlash('success', 'flash.attribute group.attributes added'); return $this->redirectToRoute('pim_enrich_attributegroup_edit', ['id' => $group->getId()]); }
/** * Add attributes to a group * * @param Request $request The request object * @param int $id The group id to add attributes to * * @AclAncestor("pim_enrich_attributegroup_add_attribute") * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function addAttributesAction(Request $request, $id) { $group = $this->findAttributeGroupOr404($id); $availableAttributes = new AvailableAttributes(); $attributesForm = $this->getAvailableAttributesForm($this->getGroupedAttributes(), $availableAttributes); $attributesForm->submit($request); $this->manager->addAttributes($group, $availableAttributes->getAttributes()); $this->request->getSession()->getFlashBag()->add('success', new Message('flash.attribute group.attributes added')); return new RedirectResponse($this->router->generate('pim_enrich_attributegroup_edit', ['id' => $group->getId()])); }