Create a new production.

@param Request               $request The incoming request.
@param TokenStorageInterface $token   The token storage service.

@return Response The rendered response.
330829
public function createAction(
        Request $request,
        TokenStorageInterface $token
    ): Response {
        // Get the current user.
        $user = $token->getToken()->getUser();

        // Create a new production.
        $production = new Production();
        $production->setAuthor($user->getUsername());
        $production->setActive(true);

        // Create and handle the form.
        $form = $this->form->create(ProductionType::class, $production);
        $form->handleRequest($request);

        // Form is submitted and valid.
        if ($form->isSubmitted() && $form->isValid()) {
            // Cascade active property to image.
            if (null !== $image = $production->getImage()) {
                $image->setActive($production->isActive());
            }

            // Cascade active property to banner.
            if (null !== $banner = $production->getBanner()) {
                $banner->setActive($production->isActive());
            }

            // Persist the production
            $this->em->persist($production);
            $this->em->flush();

            // Set success message and redirect.
            $this->session->getFlashBag()->add(
                'success',
                $this->translator->trans('production.created', [
                    '%production%' => $production->getName(),
                ], BkstgCoreBundle::TRANSLATION_DOMAIN)
            );

            return new RedirectResponse($this->url_generator->generate('bkstg_production_admin_index'));
        }

        // Render the form.
        return new Response($this->templating->render('@BkstgCore/ProductionAdmin/create.html.twig', [
            'form' => $form->createView(),
        ]));
    }
721541
public function createAction(Request $request)
    {
        $form = $this->buildForm();

        if ($request->isMethod('POST') && $this->submitForm($form, $request)->isValid()) {
            try {
                $this->getDomainManager()->create($form->getData());
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction('create', $form, Response::HTTP_CREATED);
    }
1225492
public function store(Request $request)
    {
        $feature = new Feature();

        
        $feature->name = $request->name;

        $feature->featuretype_id = $request->featuretype_id;
        
        $feature->description = $request->description;

        
        $feature->demonstration_URL = $request->demonstration_URL;

        if($feature->package_id == '') {
            $feature->package_id = null;

        } else {
            $feature->package_id = $request->package_id;
            
        }

        
        
        $feature->save();

        return redirect('unstarter/feature');
    }
466293
public function fetchRequestToken($request)
    {
        $this->getVersion($request);

        $consumer = $this->getConsumer($request);

        // no token required for the initial token request
        $token = null;

        $this->checkSignature($request, $consumer, $token);

        $new_token = $this->dataStore->newRequestToken($consumer);

        return $new_token;
    }
75473
public function refreshCreateAccessTokenResponse(
        ClientInterface $client,
        \Limoncello\OAuthServer\Contracts\TokenInterface $token,
        bool $isScopeModified,
        array $scope = null,
        array $extraParameters = []
    ): ResponseInterface {
        $this->logDebug('Prepare refresh token.');

        /** @var TokenInterface $token */
        assert($token instanceof TokenInterface);

        $updatedToken   = clone $token;
        $tokenExpiresIn = $this->getIntegration()->isRenewRefreshValue() === false ?
            $this->setUpTokenValue($updatedToken) : $this->setUpTokenValues($updatedToken);

        $tokenRepo = $this->getIntegration()->getTokenRepository();
        if ($isScopeModified === false) {
            $tokenRepo->updateValues($updatedToken);
        } else {
            assert(is_array($scope));
            $tokenRepo->inTransaction(function () use ($tokenRepo, $updatedToken, $scope) {
                $tokenRepo->updateValues($updatedToken);
                $tokenRepo->unbindScopes($updatedToken->getIdentifier());
                $tokenRepo->bindScopeIdentifiers($updatedToken->getIdentifier(), $scope);
            });
            $updatedToken->setScopeModified()->setScopeIdentifiers($scope);
        }
        $response = $this->createBodyTokenResponse($updatedToken, $tokenExpiresIn);

        return $response;
    }
1071088
public function uploadProfileImage(Request $request, $id)
    {

        if (!$id) {
            throw $this->createNotFoundException('Unable to upload.');
        }

        if ($id != $this->get('security.token_storage')->getToken()->getUser()->getId()) {
            throw $this->createNotFoundException('Can not upload anything to a profile that is not their own.');
        }
        
        $em = $this->container->get('doctrine')->getManager();
        $entity = $this->get('security.token_storage')->getToken()->getUser();
        if ($request->files->get('file') instanceof UploadedFile) {
            $imagePath = $this->get('core_manager')->uploadProfileImagePost($request->files->get('file'), $entity);
            $img = new Image();
            $img->setPath($imagePath);
            $em->persist($img);
            $entity->setImage($img);
            $em->flush();
        }

        return new JsonResponse($imagePath);

    }
1194777
private function createToken(Request $request)
    {
        $tokenString = $request->headers->get($this->header);

        if ($this->header == self::HEADER_AUTH && 0 === strpos((string)$tokenString, 'Bearer ')) {
            $tokenString = substr($tokenString, 7);
        }

        if (!$tokenString) {
            return null;
        }

        return new JwtAuthenticationToken([], $tokenString);
    }
1154352
public function showResetForm(Request $request, $token = null)
    {
        $data = new PasswordResetData();
        $data->setToken($token);

        $form = $this->form(new PasswordResetForm($data));

        return view('auth.passwords.reset')->with([
            'form' => $form
        ]);
    }
952685
public function build(RequestInterface $request): ResponseInterface
    {
        return $this->responseFactory->createResponse(
            $this->getMockStatusForRequest($request),
            '',
            $this->getMockHeadersForRequest($request),
            $this->getMockBodyForRequest($request)
        );
    }
842396
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
    {
        if ($request->isXmlHttpRequest()) {
            $result = array('success' => true);
            $response = new JsonResponse($result);

            return $response;
        }
    }
176226
public function searchResultsAction(Request $request, $token)
    {
        $this->denyAccessIfProfilerDisabled();

        if (null !== $this->cspHandler) {
            $this->cspHandler->disableCsp();
        }

        $profile = $this->profiler->loadProfile($token);

        $ip = $request->query->get('ip');
        $method = $request->query->get('method');
        $statusCode = $request->query->get('status_code');
        $url = $request->query->get('url');
        $start = $request->query->get('start', null);
        $end = $request->query->get('end', null);
        $limit = $request->query->get('limit');

        return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', [
            'request' => $request,
            'token' => $token,
            'profile' => $profile,
            'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode),
            'ip' => $ip,
            'method' => $method,
            'status_code' => $statusCode,
            'url' => $url,
            'start' => $start,
            'end' => $end,
            'limit' => $limit,
            'panel' => null,
        ]), 200, ['Content-Type' => 'text/html']);
    }
78770
public function store(Request $request)
    {
        try {
            $this->roleRepositoryInterface->create($request->all());
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('roles.create')
              ->withErrors($e->getErrors())
              ->withInput();
        }

        Flash::success(trans('dashboard::dashboard.flash.role.create.success'));

        return redirect()->route('roles.index');
    }
980987
public function authenticateWithToken(TokenInterface $token, Request $request, string $providerKey = null)
    {
        $this->migrateSession($request, $token, $providerKey);
        $this->tokenStorage->setToken($token);

        if (null !== $this->dispatcher) {
            $loginEvent = new InteractiveLoginEvent($request, $token);
            $this->dispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN);
        }
    }
475187
public function detailsAction(string $token, int $requestIndex): Response
    {
        $this->profiler->disable();

        $profile = $this->profiler->loadProfile($token);
        /** @var ClientDataCollector $collector */
        $collector = $profile->getCollector('contentful');
        $messages = $collector->getMessages();

        $message = $messages[$requestIndex];

        $body = $this->twig->render('@Contentful/Collector/details.html.twig', [
            'requestIndex' => $requestIndex,
            'message' => $message,
        ]);

        return new Response($body);
    }
164958
public function put(TokenInterface $token)
    {
        $this->stash->regenerate();
        $this->stash->set('token', $token);

        return $this;
    }
38595
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
    {
        $user = $token->getUser();

        $this->dispatcher->dispatch(self::OAUTH_LOGIN_SUCCESS, new UserEvent($user));

        return $this->authResponseService->authenticateResponse($user,
            new Response($this->twig->render('@StarterKitStart/oauth-success.html.twig')));
    }
1260202
public function resetAction(Request $request, $token)
    {
        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->get('fos_user.resetting.form.factory');
        /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
        $userManager = $this->get('fos_user.user_manager');
        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');

        $user = $userManager->findUserByConfirmationToken($token);

        if (null === $user) {
            throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
        }

        $event = new GetResponseUserEvent($user, $request);
        $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_INITIALIZE, $event);

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

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

        $form->handleRequest($request);

        if ($form->isValid()) {
            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_SUCCESS, $event);

            $userManager->updateUser($user);

            if (null === $response = $event->getResponse()) {
                $url = $this->generateUrl('fos_user_profile_show');
                $response = new RedirectResponse($url);
            }

            $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_COMPLETED, new FilterUserResponseEvent($user, $request, $response));

            return $response;
        }

        return $this->render('FOSUserBundle:Resetting:reset.html.twig', array(
            'token' => $token,
            'form' => $form->createView(),
        ));
    }