コード例 #1
0
 /**
  * {@inheritdoc}
  *
  * @Template
  * @AclAncestor("pim_enrich_variant_group_create")
  */
 public function createAction(Request $request)
 {
     if (!$request->isXmlHttpRequest()) {
         return new RedirectResponse($this->router->generate('pim_enrich_variant_group_index'));
     }
     $group = $this->groupFactory->createGroup('VARIANT');
     $group->setProductTemplate($this->productTemplateBuilder->createProductTemplate());
     if ($this->groupHandler->process($group)) {
         $request->getSession()->getFlashBag()->add('success', new Message('flash.variant group.created'));
         $url = $this->router->generate('pim_enrich_variant_group_edit', ['code' => $group->getCode()]);
         $response = ['status' => 1, 'url' => $url];
         return new Response(json_encode($response));
     }
     return ['form' => $this->groupForm->createView()];
 }
コード例 #2
0
 /**
  * Edit a group
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Group $group
  *
  * @Template
  * @AclAncestor("pim_enrich_group_edit")
  *
  * @return array
  */
 public function editAction(Group $group)
 {
     if ($this->groupHandler->process($group)) {
         $this->addFlash('success', 'flash.group.updated');
     }
     return ['form' => $this->groupForm->createView(), 'currentGroup' => $group->getId()];
 }
コード例 #3
0
 /**
  * Edit a family
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Family $family
  *
  * @Template
  * @AclAncestor("pim_enrich_family_index")
  *
  * @return array
  */
 public function editAction(Family $family)
 {
     if ($this->familyHandler->process($family)) {
         $this->addFlash('success', 'flash.family.updated');
     }
     return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelManager->getChannels()];
 }
コード例 #4
0
 /**
  * Edit a group type
  *
  * @param GroupType $groupType
  *
  * @Template
  * @AclAncestor("pim_enrich_grouptype_edit")
  *
  * @return array
  */
 public function editAction(GroupType $groupType)
 {
     if ($this->groupTypeHandler->process($groupType)) {
         $this->addFlash('success', 'flash.group type.updated');
     }
     return ['form' => $this->groupTypeForm->createView()];
 }
コード例 #5
0
 /**
  * Edit a group type
  *
  * @param GroupType $groupType
  *
  * @Template
  * @AclAncestor("pim_enrich_grouptype_edit")
  *
  * @return array
  */
 public function editAction(GroupType $groupType)
 {
     if ($this->groupTypeHandler->process($groupType)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.group type.updated'));
     }
     return ['form' => $this->groupTypeForm->createView()];
 }
コード例 #6
0
 /**
  * Edit a group
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Group $group
  *
  * @Template
  * @AclAncestor("pim_enrich_group_edit")
  *
  * @return array
  */
 public function editAction(Group $group)
 {
     if ($this->groupHandler->process($group)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.group.updated'));
     }
     return ['form' => $this->groupForm->createView(), 'currentGroup' => $group->getId()];
 }
コード例 #7
0
 /**
  * Edit channel
  *
  * @param Channel $channel
  *
  * @Template
  * @AclAncestor("pim_enrich_channel_edit")
  * @return array
  */
 public function editAction(Channel $channel)
 {
     if ($this->channelHandler->process($channel)) {
         $this->addFlash('success', 'flash.channel.saved');
         return $this->redirect($this->generateUrl('pim_enrich_channel_edit', array('id' => $channel->getId())));
     }
     return array('form' => $this->channelForm->createView());
 }
コード例 #8
0
 /**
  * Edit channel
  *
  * @param Channel $channel
  *
  * @Template
  * @AclAncestor("pim_enrich_channel_edit")
  *
  * @return array
  */
 public function editAction(Channel $channel)
 {
     if ($this->channelHandler->process($channel)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.channel.saved'));
         return new RedirectResponse($this->router->generate('pim_enrich_channel_edit', ['id' => $channel->getId()]));
     }
     return ['form' => $this->channelForm->createView()];
 }
コード例 #9
0
 /**
  * Edit attribute form
  *
  * @param int $id
  *
  * @Template("PimEnrichBundle:Attribute:form.html.twig")
  * @AclAncestor("pim_enrich_attribute_edit")
  *
  * @return array
  */
 public function editAction(Request $request, $id)
 {
     $attribute = $this->findAttributeOr404($id);
     if ($this->attributeHandler->process($attribute)) {
         $request->getSession()->getFlashBag()->add('success', new Message('flash.attribute.updated'));
     }
     return ['form' => $this->attributeForm->createView(), 'locales' => $this->localeRepository->getActivatedLocaleCodes(), 'disabledLocales' => $this->localeRepository->findBy(['activated' => false]), 'measures' => $this->measuresConfig, 'created' => $this->versionManager->getOldestLogEntry($attribute), 'updated' => $this->versionManager->getNewestLogEntry($attribute)];
 }
コード例 #10
0
 /**
  * Edit attribute group
  *
  * @param AttributeGroup $group
  *
  * @Template
  * @AclAncestor("pim_enrich_attributegroup_edit")
  *
  * @return array
  */
 public function editAction(AttributeGroup $group)
 {
     $groups = $this->attributeGroupRepo->getIdToLabelOrderedBySortOrder();
     if ($this->formHandler->process($group)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.attribute group.updated'));
         return new RedirectResponse($this->router->generate('pim_enrich_attributegroup_edit', ['id' => $group->getId()]));
     }
     return ['groups' => $groups, 'group' => $group, 'form' => $this->form->createView(), 'attributesForm' => $this->getAvailableAttributesForm($this->getGroupedAttributes())->createView()];
 }
コード例 #11
0
 /**
  * Edit attribute form
  *
  * @param Request $request
  * @param int     $id
  *
  * @Template("PimEnrichBundle:Attribute:form.html.twig")
  * @AclAncestor("pim_enrich_attribute_edit")
  *
  * @return array
  */
 public function editAction(Request $request, $id)
 {
     $attribute = $this->findAttributeOr404($id);
     if ($this->attributeHandler->process($attribute)) {
         $this->addFlash('success', 'flash.attribute.updated');
         return $this->redirectToRoute('pim_enrich_attribute_edit', ['id' => $attribute->getId()]);
     }
     return ['form' => $this->attributeForm->createView(), 'locales' => $this->localeRepository->getActivatedLocaleCodes(), 'disabledLocales' => $this->localeRepository->findBy(['activated' => false]), 'measures' => $this->measuresConfig, 'created' => $this->versionManager->getOldestLogEntry($attribute), 'updated' => $this->versionManager->getNewestLogEntry($attribute)];
 }
コード例 #12
0
 /**
  * Edit attribute group
  *
  * @param AttributeGroup $group
  *
  * @Template
  * @AclAncestor("pim_enrich_attributegroup_edit")
  *
  * @return array
  */
 public function editAction(AttributeGroup $group)
 {
     $groups = $this->attributeGroupRepo->getIdToLabelOrderedBySortOrder();
     if ($this->formHandler->process($group)) {
         $this->addFlash('success', 'flash.attribute group.updated');
         return $this->redirectToRoute('pim_enrich_attributegroup_edit', ['id' => $group->getId()]);
     }
     return ['groups' => $groups, 'group' => $group, 'form' => $this->form->createView(), 'attributesForm' => $this->getAvailableAttributesForm($this->getGroupedAttributes())->createView()];
 }
コード例 #13
0
 /**
  * Edit an association type
  *
  * @param Request $request
  * @param int     $id
  *
  * @Template
  * @AclAncestor("pim_enrich_associationtype_edit")
  *
  * @return array
  */
 public function editAction(Request $request, $id)
 {
     $associationType = $this->findOr404('PimCatalogBundle:AssociationType', $id);
     if ($this->assocTypeHandler->process($associationType)) {
         $this->addFlash('success', 'flash.association type.updated');
         return $this->redirectToRoute('pim_enrich_associationtype_edit', ['id' => $id]);
     }
     $usageCount = $this->assocRepository->countForAssociationType($associationType);
     return ['form' => $this->assocTypeForm->createView(), 'usageCount' => $usageCount];
 }
コード例 #14
0
 /**
  * {@inheritdoc}
  *
  * TODO: find a way to use param converter with interfaces
  *
  * @AclAncestor("pim_enrich_variant_group_edit")
  * @Template
  */
 public function editAction(Group $group)
 {
     if (!$group->getType()->isVariant()) {
         throw new NotFoundHttpException(sprintf('Variant group with id %d not found.', $group->getId()));
     }
     if ($this->groupHandler->process($group)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.variant group.updated'));
     }
     return ['form' => $this->groupForm->createView(), 'currentGroup' => $group->getId(), 'attributesForm' => $this->getAvailableAttributesForm($group)->createView()];
 }
コード例 #15
0
 /**
  * Edit a family
  *
  * @param int $id
  *
  * @Template
  * @AclAncestor("pim_enrich_family_index")
  *
  * @return array
  */
 public function editAction($id)
 {
     $family = $this->familyRepository->find($id);
     if (null === $family) {
         throw new NotFoundHttpException(sprintf('%s entity not found', $this->familyClass));
     }
     if ($this->familyHandler->process($family)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.family.updated'));
     }
     return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelManager->getChannels()];
 }
コード例 #16
0
 /**
  * Edit an association type
  *
  * @param int     $id
  *
  * @Template
  * @AclAncestor("pim_enrich_associationtype_edit")
  *
  * @return array
  */
 public function editAction($id)
 {
     $associationType = $this->assocTypeRepo->find($id);
     if (!$associationType) {
         throw new NotFoundHttpException(sprintf('%s entity not found', 'PimCatalogBundle:AssociationType'));
     }
     if ($this->assocTypeHandler->process($associationType)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.association type.updated'));
         return new RedirectResponse($this->router->generate('pim_enrich_associationtype_edit', ['id' => $id]));
     }
     $usageCount = $this->assocRepository->countForAssociationType($associationType);
     return ['form' => $this->assocTypeForm->createView(), 'usageCount' => $usageCount];
 }