Creates a form to edit a UserGroup entity.

@param UserGroup $entity The entity

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

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

        return $form;
    }
584684
public function actionCreate($entity)
    {
        /* @var $commentModel CommentModel */
        $commentModel = Yii::createObject($this->getModule()->commentModelClass);
        $event = Yii::createObject(['class' => CommentEvent::class, 'commentModel' => $commentModel]);
        $commentModel->setAttributes($this->getCommentAttributesFromEntity($entity));
        $this->trigger(self::EVENT_BEFORE_CREATE, $event);
        if ($commentModel->load(Yii::$app->request->post()) && $commentModel->saveComment()) {
            $this->trigger(self::EVENT_AFTER_CREATE, $event);

            return ['status' => 'success'];
        }

        return [
            'status' => 'error',
            'errors' => ActiveForm::validate($commentModel),
        ];
    }
518809
private function createEditForm(PermissionsGroup $permissionsGroup)
    {
        $form = $this->createForm(new PermissionsGroupType(), $permissionsGroup, array(
            'action' => $this->generateUrl('admin_permissionsgroup_update', array('id' => $permissionsGroup->getId())),
            'method' => 'PUT',
        ));

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

        return $form;
    }
252228
private function createEditForm(User $oUser)
        {
            $form = $this->createForm(new UserType(), $oUser, array(
                'action' => $this->generateUrl('backend_system_user_update', array('id' => $oUser->getId())),
                'method' => 'PUT',
            ));

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

            return $form;
        }
943462
public function addUser(\FOM\UserBundle\Entity\User $user)
    {
        $this->users[] = $user;
        $user->addGroup($this);
        return $this;
    }
937148
private function createEditForm(GalleryItem $entity)
    {
        $form = $this->createForm(new GalleryItemType(), $entity, array(
            'action' => $this->generateUrl('admin_galleryitem_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

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

        return $form;
    }
360281
public function editAction(Request $request, $groupName)
    {
        $acl = $this->get('bacon_acl.service.authorization');

        if (!$acl->authorize('groups', 'EDIT')) {
            throw $this->createAccessDeniedException();
        }

        $group = $this->findGroupBy('name', $groupName);

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');

        $event = new GetResponseGroupEvent($group, $request);
        $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_INITIALIZE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->get('fos_user.group.form.factory');

        $form = $formFactory->createForm();
        $form->setData($group);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /** @var $groupManager \FOS\UserBundle\Model\GroupManagerInterface */
            $groupManager = $this->get('fos_user.group_manager');

            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_SUCCESS, $event);

            $groupManager->updateGroup($group);

            $this->get('session')->getFlashBag()->add('message', [
                'type' => 'success',
                'message' => sprintf('The record has been %s successfully.','updated'),
            ]);


            if (null === $response = $event->getResponse()) {
                $url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
                $response = new RedirectResponse($url);
            }

            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_COMPLETED, new FilterGroupResponseEvent($group, $request, $response));

            return $response;
        }

        return $this->render('FOSUserBundle:Group:edit.html.twig', array(
            'form'      => $form->createview(),
            'group_name'  => $group->getName(),
            'group'         => $group,
        ));
    }
680288
private function createCreateForm(Media $entity) {

        $types = $this->container->getParameter('flowcode_media.media_types');
        $class = $types[$entity->getMediaType()]["class_type"];

        $form = $this->createForm(new $class(), $entity, array(
            'action' => $this->generateUrl('admin_media_create', array("type" => $entity->getMediaType())),
            'method' => 'POST',
        ));

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

        return $form;
    }
685369
public function edit($id)
    {
        $user = UserRepository::find($id);
        $this->checkUser($user);

        $groups = GroupRepository::index();

        return View::make('credentials::users.edit', compact('user', 'groups'));
    }
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;
    }
567439
public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $user = $em->getRepository('ChillMainBundle:User')->find($id);

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

        $editForm = $this->createEditForm($user);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

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

        return $this->render('ChillMainBundle:User:edit.html.twig', array(
            'entity'      => $user,
            'edit_form'   => $editForm->createView(),
            'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(),
            'delete_groupcenter_form' => array_map( 
                    function(\Symfony\Component\Form\Form $form) {
                        return $form->createView();
                
                    },
                    iterator_to_array($this->getDeleteLinkGroupCenterByUser($user), true))
        ));
    }
700320
public function editAction()
    {
        $form = $this->getEditForm();
        $entity = $form->getObject();
        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost()->toArray();
            $entityManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
            $hydrator = new DoctrineHydrator($entityManager);
            $hydrator->hydrate($data, $entity);

            if ($form->isValid()) {
                $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
                $objectManager->persist($entity);
                $objectManager->flush();
                $controller = explode('/', $this->getRequest()->getUri()->getPath())[2];
                if (!$this->getRequest()->isXmlHttpRequest()) {
                    return $this->redirect()->toRoute(null, ['controller' => $controller]);
                }
                return;
            } else {
                $this->getResponse()->setStatusCode(400);
            }
        }
        $viewModel = $this->getViewModel();
        $viewModel->setTerminal($this->getRequest()->isXmlHttpRequest());

        return $viewModel->setVariables(['form' => $form]);
    }
1211765
protected function createCreateForm($entity)
    {
        $form = $this->createForm(
            $this->getAddFormType(), $entity, [
                'action' => $this->generateUrl($this->getRouteName() . "Add", $this->getRouteParams()),
                'method' => 'POST',
            ]
        );

        return $form;
    }
1131599
private function createCreateForm(Agreement $entity)
    {
        $form = $this->createForm(new AgreementType(), $entity, array(
            'action' => $this->generateUrl('agreement_create'),
            'method' => 'POST',
        ));

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

        return $form;
    }
934906
public function formList($entity)
    {
        if ($entity = Entity::fromYamlFile($entity)) {
            $list = new FormList($entity);

            return $list->view();
        } else {
            abort(404);
        }
    }
443718
private function createEditForm(Role $entity)
    {
        $form = $this->createForm('sam_role', $entity, array(
            'action' => $this->generateUrl('sam_role_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        return $form;
    }
455805
private function createAttributesQuery(User $user)
    {
        $query = $this->getEntityManager()
            ->createQuery('
                SELECT ua
                FROM UserBundle:UserAttribute ua
                LEFT JOIN ua.groups ug
                INDEX BY ua.id
                WHERE ug.id IN (:groupIds)
            ')
        ->setParameters([
            ':groupIds' => $user->getGroupIds(),
        ]);

        return $query;
    }