Creates a form to create a User entity.

@param User $entity The entity

@return \Symfony\Component\Form\Form The form
969546
private function createCreateForm(User $entity)
    {
        $form = $this->createForm(new UserType(), $entity, array(
            'action' => $this->generateUrl('admin_user_create'),
            'method' => 'POST',
            'is_creation' => true
        ));

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

        return $form;
    }
780221
protected function createEntityVersionLock(User $user, LockableEntity $entity)
    {
        /** @var EntityVersionLock $lock */
        $lock = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock')->findOneBy([
            'owner' => $user->getUsername(),
            'lockableEntity' => $entity,
        ]);
        if (!$lock) {
            $lock = new EntityVersionLock();
        }
        $lock->setOwner($user->getUsername());
        $lock->setLockableEntity($entity);
        $lock->setCreatedAt(new \DateTime());
        $this->objectManager->persist($lock);
        $this->objectManager->flush();
    }
724764
private function createCreateForm(RegistrationRole $entity)
    {
        $form = $this->createForm('sam_create_role', $entity, array(
            'action' => $this->generateUrl('sam_role_create'),
            'method' => 'POST'
        ));

        return $form;
    }
294119
public function createUserRole(User $user)
    {
        $username = $user->getUsername();
        $roleName = 'ROLE_USER_'.strtoupper($username);
        $role = $this->getRoleByName($roleName);

        $this->om->startFlushSuite();

        if (is_null($role)) {
            $role = new Role();
            $role->setName($roleName);
            $role->setTranslationKey($username);
            $role->setReadOnly(true);
            $role->setType(Role::USER_ROLE);
            $this->om->persist($role);
        }

        $user->addRole($role);
        $this->om->endFlushSuite();

        return $role;
    }
1187980
private function createRegisterForm(User $user)
    {
        $form = $this->createForm(new UserRegisterType(), $user, array(
            'action' => $this->generateUrl('amulen_user_register_do'),
            'method' => 'POST',
        ));

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

        return $form;
    }
1164445
public function create(UserInterface $user)
    {
        $entity = static::ENTITY_CLASSNAME;

        $activation = new $entity($user);

        $this->save($activation);

        return $activation;
    }
585633
public function newAction()
        {
            $oUser = new User();
            $form   = $this->createCreateForm($oUser);

            return $this->render('SlashworksBackendBundle:User:new.html.twig', array(
                'entity' => $oUser,
                'form'   => $form->createView(),
            ));
        }
476560
public function create(User $user)
    {
        /* handle encode */
        $user = $this->encode($user);

        $this->getEm()->persist($user);
        $this->getEm()->flush();

        return $user;
    }
691114
private function createCreateForm(Advert $entity)
    {
        $form = $this->createForm(new AdvertFrontType(), $entity, array(
            'action' => $this->generateUrl('ecommerce_advertfront_create'),
            'method' => 'POST',
        ));

        return $form;
    }
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;
    }
233355
public function getUserEntity($user)
    {
        if (is_numeric($user)) {
            $userEntity = $this->entityTypeManager
                ->getStorage('user')
                ->load($user);
        } else {
            $userEntities = $this->entityTypeManager
                ->getStorage('user')
                ->loadByProperties(['name' => $user]);
            $userEntity = reset($userEntities);
        }

        return $userEntity;
    }
1052277
public function doAuthentication(UserInterface $user)
    {
        /** @var \PServerCore\Entity\Repository\User $repository */
        $repository = $this->entityManager->getRepository($this->getUserEntityClassName());

        // fix if we have a proxy we don´t have a valid entity, so we have to clear before we can create a new select
        $username = $user->getUsername();
        $repository->clear();

        $userNew = $repository->getUser4UserName($username);

        $authService = $this->getAuthService();

        $authService->getStorage()->write($userNew);
    }
721458
public function insert($entity)
    {
        $persistor = new DoctrinePersistor(
            $this->connection,
            $this->table,
            $this->entityRegistry->getEntityBuilder(),
            $this->entityRegistry
        );
        $persistor->insert($entity);
    }
1273014
public function resetPasswordAction(Request $request, User $user)
    {
        $form = $this->createFormBuilder(null, $this->getDefaultFormOptions($request, $user->getId()))->getForm();

        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->get(UserManagerInterface::class)->requestNewPassword($user);
            $this->saveEntity($user);

            if ($request->isXmlHttpRequest()) {
                return array_merge(
                    $this->getViewParameters($request, $form, $user),
                    [
                        'dataId' => $user->getId(),
                        'success' => 1,
                    ]
                );
            }

            return $this->redirectToAction('list');
        }

        return $this->renderAction(
            array_merge(
                $this->getViewParameters($request, $form, $user),
                [
                    'dataId' => $user->getId(),
                ]
            )
        );
    }
1211765
protected function createCreateForm($entity)
    {
        $form = $this->createForm(
            $this->getAddFormType(), $entity, [
                'action' => $this->generateUrl($this->getRouteName() . "Add", $this->getRouteParams()),
                'method' => 'POST',
            ]
        );

        return $form;
    }
255106
public function create(UserInterface $user)
    {
        $entity = static::ENTITY_CLASSNAME;

        $reminder = new $entity($user);

        $this->save($reminder);

        return $reminder;
    }
680679
private function createEditForm(Advert $entity)
    {
        
        $formConfig = array();
        $user = $this->container->get('security.token_storage')->getToken()->getUser();  
        if ($user->isGranted('ROLE_ADMIN') || $user->isGranted('ROLE_SUPER_ADMIN')) {
            $formConfig['admin'] = true;
        }
        $form = $this->createForm('EcommerceBundle\Form\AdvertEditType', $entity, array_merge($formConfig, array(
            'action' => $this->generateUrl('ecommerce_advert_edit', array('id' => $entity->getId())),
            'method' => 'POST',
        )));
        
        return $form;
    }