/**
  * 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];
 }
 /**
  * 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];
 }
 /**
  * Get association count by association type
  *
  * @param AssociationTypeInterface $type
  *
  * @return int
  */
 public function countForAssociationType(AssociationTypeInterface $type)
 {
     return $this->repository->countForAssociationType($type);
 }