/**
  * 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];
 }
 /**
  * {@inheritdoc}
  */
 protected function createEntity($class, array $data)
 {
     return $this->attributeManager->createAttribute($data['type']);
 }
 /**
  * Create an attribute.
  *
  * @param string $type
  *
  * @return AbstractAttribute
  */
 public function createAttribute($type = null)
 {
     return $this->baseAttributeManager->createAttribute($type);
 }