/**
  * Create attribute
  * @param Request $request
  *
  * @Template("PimEnrichBundle:Attribute:form.html.twig")
  * @AclAncestor("pim_enrich_attribute_create")
  * @return array
  */
 public function createAction(Request $request)
 {
     $attributeType = $request->get('attribute_type');
     $attributeTypes = $this->attributeManager->getAttributeTypes();
     if (!$attributeType || !is_string($attributeType) || !array_key_exists($attributeType, $attributeTypes)) {
         return $this->redirectToRoute('pim_enrich_attribute_index');
     }
     $attribute = $this->attributeManager->createAttribute($attributeType);
     if ($this->attributeHandler->process($attribute)) {
         $this->addFlash('success', 'flash.attribute.created');
         return $this->redirectToRoute('pim_enrich_attribute_edit', ['id' => $attribute->getId()]);
     }
     return ['form' => $this->attributeForm->createView(), 'locales' => $this->localeManager->getActiveLocales(), 'disabledLocales' => $this->localeManager->getDisabledLocales(), 'measures' => $this->measuresConfig, 'attributeType' => $attributeType];
 }
 /**
  * Create attribute
  *
  * @param Request $request
  *
  * @Template("PimEnrichBundle:Attribute:form.html.twig")
  * @AclAncestor("pim_enrich_attribute_create")
  *
  * @return array
  */
 public function createAction(Request $request)
 {
     $attributeType = $request->get('attribute_type');
     $attributeTypes = $this->attributeManager->getAttributeTypes();
     if (!$attributeType || !is_string($attributeType) || !array_key_exists($attributeType, $attributeTypes)) {
         return new RedirectResponse($this->router->generate('pim_enrich_attribute_index'));
     }
     $attribute = $this->attributeManager->createAttribute($attributeType);
     if ($this->attributeHandler->process($attribute)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.attribute.created'));
         return new RedirectResponse($this->router->generate('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, 'attributeType' => $attributeType];
 }
 /**
  * Get a list of available attribute types.
  *
  * @return string[]
  */
 public function getAttributeTypes()
 {
     return $this->baseAttributeManager->getAttributeTypes();
 }
 /**
  * Return available frontend type
  *
  * @return array
  */
 protected function getAttributeTypeChoices()
 {
     return $this->attributeManager->getAttributeTypes();
 }
 function let(AttributeManager $manager, AddAttributeTypeRelatedFieldsSubscriber $subscriber, FormBuilderInterface $builder)
 {
     $manager->getAttributeTypes()->willReturn(['text', 'number', 'email']);
     $this->beConstructedWith($manager, $subscriber, 'Pim\\Bundle\\CatalogBundle\\Entity\\AttributeTranslation', 'Pim\\Bundle\\CatalogBundle\\Entity\\Attribute', 'Pim\\Bundle\\CatalogBundle\\Entity\\AttributeGroup');
 }