public function newApp(Request $request)
    {
        if ($request->request->get('type') === ApiApplication::DESKTOP_TYPE) {
            $form = new \API_OAuth2_Form_DevAppDesktop($request);
        } else {
            $form = new \API_OAuth2_Form_DevAppInternet($request);
        }

        $violations = $this->getValidator()->validate($form);

        if ($violations->count() === 0) {
            $user = $this->getAuthenticatedUser();
            $application = $this->getApiApplicationManipulator()
                ->create(
                    $form->getName(),
                    $form->getType(),
                    $form->getDescription(),
                    sprintf('%s%s', $form->getSchemeWebsite(), $form->getWebsite()),
                    $user,
                    sprintf('%s%s', $form->getSchemeCallback(), $form->getCallback())
                );

            // create an account as well
            $this->getApiAccountManipulator()->create($application, $user, V2::VERSION);

            return $this->app->redirectPath('developers_application', ['application' => $application->getId()]);
        }

        return $this->render('/developers/application_form.html.twig', [
            "violations" => $violations,
            "form"       => $form,
        ]);
    }
public function newApp(Request $request)
    {
        if ($request->request->get('type') === ApiApplication::DESKTOP_TYPE) {
            $form = new \API_OAuth2_Form_DevAppDesktop($request);
        } else {
            $form = new \API_OAuth2_Form_DevAppInternet($request);
        }

        $violations = $this->getValidator()->validate($form);

        if ($violations->count() === 0) {
            $user = $this->getAuthenticatedUser();
            $application = $this->getApiApplicationManipulator()
                ->create(
                    $form->getName(),
                    $form->getType(),
                    $form->getDescription(),
                    sprintf('%s%s', $form->getSchemeWebsite(), $form->getWebsite()),
                    $user,
                    sprintf('%s%s', $form->getSchemeCallback(), $form->getCallback())
                );

            // create an account as well
            $this->getApiAccountManipulator()->create($application, $user, V2::VERSION);

            return $this->app->redirectPath('developers_application', ['application' => $application->getId()]);
        }

        return $this->render('/developers/application_form.html.twig', [
            "violations" => $violations,
            "form"       => $form,
        ]);
    }
public function newApp ( Request $ request ) { if ( $ request -> request -> get ( 'type' ) === ApiApplication :: DESKTOP_TYPE ) { $ form = new \ API_OAuth2_Form_DevAppDesktop ( $ request ) ; } else { $ form = new \ API_OAuth2_Form_DevAppInternet ( $ request ) ; } $ violations = $ this -> getValidator ( ) -> validate ( $ form ) ; if ( $ violations -> count ( ) === 0 ) { $ user = $ this -> getAuthenticatedUser ( ) ; $ application = $ this -> getApiApplicationManipulator ( ) -> create ( $ form -> getName ( ) , $ form -> getType ( ) , $ form -> getDescription ( ) , sprintf ( '%s%s' , $ form -> getSchemeWebsite ( ) , $ form -> getWebsite ( ) ) , $ user , sprintf ( '%s%s' , $ form -> getSchemeCallback ( ) , $ form -> getCallback ( ) ) ) ; // create an account as well $ this -> getApiAccountManipulator ( ) -> create ( $ application , $ user , V2 :: VERSION ) ; return $ this -> app -> redirectPath ( 'developers_application' , [ 'application' => $ application -> getId ( ) ] ) ; } return $ this -> render ( '/developers/application_form.html.twig' , [ "violations" => $ violations , "form" => $ form , ] ) ; }
Create a new developer applications

@param  Request $request The current request
@return Response
Create a new developer applications