Creates a form to edit a SurveyCategory entity.

@param SurveyCategory $entity The entity

@return \Symfony\Component\Form\Form The form
352467
private function createEditForm(SurveyCategory $entity)
    {
        $form = $this->createForm(new SurveyCategoryType(), $entity, array(
            'action' => $this->generateUrl('surveycategory_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
19642
private function createEditForm(Country $entity)
    {
        $form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
            'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->getIsoCode())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
60734
public function createCopyForm($entity, $entityClass)
    {
        return $this->createIdForm($entity, 'copy_', $this->adminRouter->generate($entity, $entityClass, AdminRouter::TYPE_COPY));
    }
815428
public function editAction(Request $request)
    {
        $entityManager = $this->getDoctrine()->getManager();
        /** @var GlobalConfigRepository $globalConfigRepository */
        $globalConfigRepository = $entityManager->getRepository(GlobalConfig::class);
        $globalConfig = $globalConfigRepository->findLast() ?: new GlobalConfig();
        $form = $this->createForm(GlobalConfigType::class, $globalConfig, []);
        $initialLogo = $globalConfig->getLogo();
        $form->handleRequest($request);

        $success = true;
        if ($form->isSubmitted()) {
            if (true === $success = $form->isValid()) {
                //cloning the entity will give it a new id in order to invalidate browser cache (in meta.html.twig)
                $entityManager->clear(GlobalConfig::class);
                $entityManager->persist($globalConfig);
                $entityManager->flush();
                if ($initialLogo !== $globalConfig->getLogo() && $globalConfig->getLogo() !== null) {
                    $this->container->get(FaviconGenerator::class)->generate(
                        $globalConfig,
                        $this->getParameter('kernel.project_dir').'/faviconConfig.json'
                    );
                }
                $this->congrat('victoire.config.global.edit.success');

                return new JsonResponse([
                    'url'     => $this->generateUrl('victoire_core_homepage_show'),
                    'success' => true,
                ]);
            }
        }

        return new JsonResponse([
            'html' => $this->renderView('VictoireConfigBundle:global:edit.html.twig', [
                'form' => $form->createView(),
            ]),
            'success' => $success,
        ]);
    }
884416
public function addCategory(\CsnCms\Entity\Category $category)
    {
        $category->addArticle($this); // synchronously updating inverse side
        $this->categories[] = $category;

        return $this;
    }
444665
public function newAction($categoryId)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Category $category */
        $category = $em->getRepository('EcommerceBundle:Category')->find($categoryId);

        if (!$category) {
            throw $this->createNotFoundException('Unable to find Category entity.');
        }

        $entity = new Category();
        $form   = $this->createForm(new SubcategoryType(), $entity);

        return array(
            'entity' => $entity,
            'category' => $category,
            'form'   => $form->createView(),
        );
    }
670176
private function createEditForm(Category $entity)
    {
        $form = $this->createForm($this->get("amulen.classification.form.category"), $entity, array(
            'action' => $this->generateUrl('admin_category_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
205737
private function createCreateForm(MessageType $entity)
    {
        $form = $this->createForm(MessageTypeType::class, $entity, array(
            'action' => $this->generateUrl('messagetype_create'),
            'method' => 'POST',
        ));
        $this->_addFunctionsToForm($form);

        $form->add('create_group', CheckboxType::class, array('label' => "This is a new group.", 'mapped' => false, 'required' => false));
        $form->add('submit', SubmitType::class, array('label' => 'Create'));

        return $form;
    }
478894
protected function deleteEntity($entity)
    {
        $this->checkEntityType($entity);

        $delete = new Delete($this->aggregate($entity), $this->newQueryBuilder());

        $delete->execute();
    }
844978
private function createCreateForm(Block $entity) {

        $types = $this->container->getParameter('flowcode_page.block_types');
        $class = $types["type_text"]["class_type"];
        $form = $this->createForm(new $class(), $entity, array(
            'action' => $this->generateUrl('block_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
752294
public function getEditForm()
    {
        if (null === $this->editForm) {
            $this->setEditForm($this->getServiceLocator()->get('dlccategory_editcategory_form'));
        }
        return $this->editForm;
    }
33933
public function editIndexAction(Request $request)
    {
        /* @var $em EntityManager */
        $em = $this->getDoctrine()->getManager();

        /* @var DashboardConfiguration $dashboardConfiguration */
        $dashboardConfiguration = $em
            ->getRepository('KunstmaanAdminBundle:DashboardConfiguration')
            ->findOneBy(array());

        if (is_null($dashboardConfiguration)) {
            $dashboardConfiguration = new DashboardConfiguration();
        }
        $form = $this->createForm(DashboardConfigurationType::class, $dashboardConfiguration);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
            if ($form->isSubmitted() && $form->isValid()) {
                $em->persist($dashboardConfiguration);
                $em->flush($dashboardConfiguration);

                $this->addFlash(
                    FlashTypes::SUCCESS,
                    $this->get('translator')->trans('kuma_admin.edit.flash.success')
                );

                return new RedirectResponse($this->generateUrl('KunstmaanAdminBundle_homepage'));
            }
        }

        return array(
            'form' => $form->createView(),
            'dashboardConfiguration' => $dashboardConfiguration,
        );
    }
934906
public function formList($entity)
    {
        if ($entity = Entity::fromYamlFile($entity)) {
            $list = new FormList($entity);

            return $list->view();
        } else {
            abort(404);
        }
    }
389889
public function editAction()
        {

            /** @var License $oLicense */
            $oLicense = LicenseQuery::create()->findOne();

            if ($oLicense === null) {
                throw $this->createNotFoundException('Unable to find License entity.');
            }

            $oLicense->setValidUntil(date("d.m.Y", $oLicense->getValidUntil()));
            $editForm = $this->createEditForm($oLicense);

            return $this->render('SlashworksAppBundle:License:edit_license.html.twig', array(
                'entity'    => $oLicense,
                'edit_form' => $editForm->createView(),
            ));
        }
1251028
public function editAction($id, Request $request)
    {
        $contentType = $this->contentTypeManager->getContentTypeById($id);

        if ($contentType === null) {
            throw EntityNotFoundException::fromClassNameAndIdentifier(
                $this->configurationManager->getEntityClass('content_type'),
                [$id]
            );
        }

        $fieldTypes = [];
        foreach ($contentType->getFields() as $field) {
            $fieldTypes[$field->getId()] = $field->getType();
        }

        $form = $this->createForm(ContentTypeFormType::class, $contentType, [
            'action' => $this->generateUrl('sherlockode_acb_content_type_edit', ['id' => $contentType->getId()]),
            'attr' => [
                'data-change-type-url' => $this->generateUrl('sherlockode_acb_content_type_change_field_type'),
                'class' => 'edit-content-type'
            ],
            'contentType' => $contentType,
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->contentTypeManager->processFieldsChangeType($contentType, $fieldTypes);
            $this->om->flush();

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

        return $this->render('@SherlockodeAdvancedContent/ContentType/edit_content_type.html.twig', [
            'form' => $form->createView(),
            'data' => $contentType,
        ]);
    }
933180
public function edit(Category $category)
    {
        return view('dashboard.sections.categories.edit', [
            'hasParent' => ! is_null($category->parent),
            'parents' => Category::parents()->get(),
            'category' => $category->load('parent'),
        ]);
    }
1163189
private function createCreateForm(Advert $entity)
    {
        $formConfig = array();
        $user = $this->container->get('security.token_storage')->getToken()->getUser();  
        if ($user->isGranted('ROLE_USER')) {
            $formConfig['actor'] = $user;
        }
        $form = $this->createForm('EcommerceBundle\Form\AdvertType', $entity, array_merge($formConfig, array(
            'action' => $this->generateUrl('ecommerce_advert_new'),
            'method' => 'POST',
        )));

        return $form;
    }