Creates a new Feature entity.

@param Request $request The request

@return array|RedirectResponse

@Route("/")
@Method("POST")
@Template("EcommerceBundle:Feature:new.html.twig")
198177
public function createAction(Request $request)
    {
        $entity = new Feature();
        $form = $this->createForm(new FeatureType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'feature.created');

            return $this->redirect($this->generateUrl('ecommerce_feature_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1222678
public function createAction(Request $request)
    {
        $title = $request->get('title', null);

        $siterootManager = $this->get('phlexible_siteroot.siteroot_manager');

        $siteroot = new Siteroot();
        foreach (explode(',', $this->container->getParameter('phlexible_gui.languages.available')) as $language) {
            $siteroot->setTitle($language, $title);
        }
        $siteroot
            ->setCreateUserId($this->getUser()->getId())
            ->setCreatedAt(new \DateTime())
            ->setModifyUserId($siteroot->getCreateUserId())
            ->setModifiedAt($siteroot->getCreatedAt());

        $siterootManager->updateSiteroot($siteroot);

        return new ResultResponse(true, 'New Siteroot created.');
    }
155702
private function createRedirectResponse(Request $request)
    {
        $url = $this->loginUrl.'?'.http_build_query([
            'redirect_to' => $request->getUri(),
            'reauth'      => 0,
        ]);

        return RedirectResponse::create($url, 302);
    }
866743
public function createAction(Request $request)
    {
        $form = $this->getForm();

        if ('POST' == $request->getMethod()) {
            $form->handleRequest($request);
            if ($form->isValid()) {

                $this->getManager()->create($form->getData());
                $this->get('session')->getFlashBag()->add('success', 'Repository created successfully');

                return new RedirectResponse($this->generateUrl('snide_travinizer_dashboard'));
            } else {
                $this->get('session')->getFlashBag()->add('error', 'Some errors have been found');

            }
        }
        return array(
            'form' => $form->createView(),
            'errors' => $form->getErrors()
        );
    }
415231
public function createAction(Request $request)
    {
        $entity = new MessageType();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);
        $data = $form->getData();
        if (!$data->getParent() && !isset($request->request->get($form->getName())['create_group'])) {
            throw new \InvalidArgumentException('You must either check "This is a new group" to verify that you want a new group or choose a group in the drop down.');
        }

        if ($form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->persist($entity);
            $em->flush();
            return $this->redirectToRoute('messagetype_show', array('id' => $entity->getId()));
        }

        return $this->render(
            'BisonLabSakonninBundle:MessageType:edit.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
844988
public function createAction(Request $request)
    {
        $template = new Template();

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            $em->persist($template);
            $em->flush();

            return $this->redirectToRoute('opifer_cms_template_edit', ['id' => $template->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Template:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
1021092
public function createAction(Request $request)
    {
        $title = $request->get('title');
        $type = $request->get('type');
        $uniqueId = $request->get('unique_id');

        if (!$uniqueId) {
            $uniqueId = preg_replace('/[^a-z0-9_]/', '_', strtolower($title));
        }

        $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
        $elementtypeService->createElementtype($type, $uniqueId, $title, null, null, [], $this->getUser()->getId());

        return new ResultResponse(true, 'Element Type created.');
    }
833222
public function newAction(Request $request)
    {
        $menu = new MenuItem();
        $form = $this->createForm('CoreExtraBundle\Form\MenuItemType', $menu, array('uploadDir'=> 'uploads/images/menu'));
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            
            //clean image form
            $this->get('core_manager')->cleanImageForm($request->files->get('menu_item'), $menu);
            
            $em = $this->getDoctrine()->getManager();
            $em->persist($menu);
            $em->flush();
            
            //images
            $image = $form->getNormData()->getImage();
            if ($image instanceof Image) {
                $this->get('core_manager')->uploadMenuImage($menu);
            }
            
            $this->get('session')->getFlashBag()->add('success', 'menu.created');

            return $this->redirectToRoute('coreextra_menuitem_show', array('id' => $menu->getId()));
        }

        return array(
            'entity' => $menu,
            'form' => $form->createView(),
        );
    }
88415
public function createAction(Request $request)
    {
        $inventoryitem = new InventoryItem();
        $form = $this->createForm(new InventoryItemType(), $inventoryitem);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($inventoryitem);
            $em->flush();

            return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $inventoryitem->getInventory()->getId())));
        }

        return array(
            'inventoryitem' => $inventoryitem,
            'form' => $form->createView(),
        );
    }
961028
public function newAction(Request $request)
    {
        $user = $this->getUser();
        $repository = $this->get('ekyna_user.address.repository');

        $address = $repository->createNew();
        $address->setUser($user);

        $cancelPath = $this->generateUrl('ekyna_user_address_list');

        /** @var \Symfony\Component\Form\FormInterface $form */
        $form = $this
            ->createForm('ekyna_user_address', $address, [
                '_redirect_enabled' => true,
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'save' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'primary',
                            'label' => 'ekyna_core.button.save',
                            'attr' => [
                                'icon' => 'ok',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $cancelPath,
                            ],
                        ],
                    ],
                ],
            ])
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = $this->get('ekyna_user.address.operator')->create($address);
            if (!$event->isPropagationStopped()) {
                $this->addFlash('ekyna_user.address.message.create.success', 'success');
                if (null !== $redirectPath = $form->get('_redirect')->getData()) {
                    return $this->redirect($redirectPath);
                }
                return $this->redirect($cancelPath);
            }
            $this->addFlash('ekyna_user.address.message.create.failure', 'danger');
        }

        return $this->render('EkynaUserBundle:Address:new.html.twig', [
            'form' => $form->createView()
        ]);
    }
837142
public function createAction(Request $request)
    {
        $user = new User();
        $form = $this->createCreateForm($user);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            
            $user->setPassword($this->get('security.password_encoder')
                    ->encodePassword($user, $form['plainPassword']['password']->getData()));
            
            $em->persist($user);
            $em->flush();

            return $this->redirect($this->generateUrl('admin_user_show', array('id' => $user->getId())));
        }

        return $this->render('ChillMainBundle:User:new.html.twig', array(
            'entity' => $user,
            'form'   => $form->createView(),
        ));
    }
1294799
public function newAction(Request $request)
    {
        $role = new Role();
        $form = $this->createForm('CoreBundle\Form\RoleType', $role);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($role);
            $em->flush($role);

            //if come from popup
            if ($request->isXMLHttpRequest()) {         
                return new JsonResponse(array(
                            'id' => $role->getId(), 
                        ));
            }
            $this->get('session')->getFlashBag()->add('success', 'role.created');
            
            return $this->redirectToRoute('core_role_show', array('id' => $role->getId()));
        }

        return array(
            'role' => $role,
            'form' => $form->createView(),
        );
    }
1266149
public function checkUniqueEntityAction(Request $request)
    {
        $data = $request->request->all();
        foreach ($data['data'] as $value) {
            // If field(s) has an empty value and it should be ignored
            if ((bool) $data['ignoreNull'] && ('' === $value || is_null($value))) {
                // Just return a positive result
                return new JsonResponse(true);
            }
        }

        $entity = $this
            ->get('doctrine')
            ->getRepository($data['entityName'])
            ->{$data['repositoryMethod']}($data['data'])
        ;

        return new JsonResponse(empty($entity));
    }
561625
public function createAction(Request $request)
    {
        $title = $request->get('title');

        $filterManager = $this->get('phlexible_message.filter_manager');

        $filter = $filterManager->create();
        $filter
            ->setUserId($this->getUser()->getId())
            ->setTitle($title)
            ->setModifiedAt(new \DateTime())
            ->setCreatedAt(new \DateTime());

        $filterManager->updateFilter($filter);

        return new ResultResponse(true, 'Filter created.');
    }
469479
public function create(Request $request)
    {
        app('soda.interface')->setHeading('New '.ucwords(trans('soda::terminology.content_type')));
        app('soda.interface')->breadcrumbs()->addLink(route('soda.content-types.index'), ucwords(trans('soda::terminology.content_type_plural')));

        try {
            $contentType = $this->contentTypes->newInstance($request);
            $contentTypes = $this->contentTypes->getList();
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.create', ['object' => trans('soda::terminology.content_type')]));
        }

        return soda_cms_view('data.content.types.view', compact('contentType', 'contentTypes'));
    }
312652
public function newAction(Request $request)
    {
        $entity = new Plan();
        $form = $this->createForm('EcommerceBundle\Form\PlanType', $entity);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            
            $checkoutManager = $this->get('checkout_manager');
            $checkoutManager->createPaypalPlan($entity);
            $checkoutManager->activePaypalPlan($entity);
            
            //if come from popup
            if ($request->isXMLHttpRequest()) {         
                return new JsonResponse(array(
                            'id' => $entity->getId(), 
                            'name' => $entity->getName()
                        ));
            }
            
            $this->get('session')->getFlashBag()->add('success', 'plan.created');

            return $this->redirectToRoute('ecommerce_plan_show', array('id' => $entity->getId()));
        }

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
650695
public function createAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');

        $domain = new Domain();

        $form = $this->createForm(DomainType::class, $domain);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($domain);
            $em->flush();

            $this->addFlash('success', 'Domaim has been created successfully');

            return $this->redirectToRoute('opifer_cms_domain_edit', ['id' => $domain->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Domain:create.html.twig', [
            'domain' => $domain,
            'form' => $form->createView()
        ]);
    }