Creates a form to create a Post entity.

@param Post $token string

@return \Symfony\Component\Form\Form The form
518497
private function createCreditCardForm()
    {
        $class = new CreditCardForm($this->get('validator'));
        $type = new CreditCardType(array());
        
        $form = $this->createForm($type, $class, array(
            'action' => $this->generateUrl('ecommerce_checkout_summary'),
            'method' => 'POST',
            'attr' => array('id' => 'payment-cc', 'class' => 'cc-form')
        ));
        $form->add('submit', 'submit', array('label' => 'Pagar'));
        
        return $form;
    }
383656
protected function _get($token = null)
    {
        $token = $this->_token($token);
        $entity = $this->_verify($token);

        if ($this->_save($entity)) {
            return $this->_success();
        }

        $this->_error();
    }
128804
public function create()
    {
        $class = $this->getClass();
        $form = new $class();

        $schema = $this->schemaManager->create();
        $schema->setObjectClass($this->postManager->getClass());

        $form->setSchema($schema);

        return $form;
    }
935328
protected function respondWithToken($token)
    {
        $tokenReponse = new \Stdclass;

        $tokenReponse->jwt = $token;
        $tokenReponse->token_type = 'bearer';
        $tokenReponse->expires_in = auth()->factory()->getTTL();

        return $this->response->item($tokenReponse, $this->getTransformer())->setStatusCode(200);
    }
247972
public function form($method = 'POST', $action = null)
    {
        $method = strtoupper($method);
        $form = Form::create();

        // If Laravel needs to spoof the form's method, we'll append a hidden
        // field containing the actual method
        if (in_array($method, ['DELETE', 'PATCH', 'PUT'])) {
            $form = $form->addChild($this->hidden('_method')->value($method));
        }

        // On any other method that get, the form needs a CSRF token
        if ($method !== 'GET') {
            $form = $form->addChild($this->token());
        }

        return $form
            ->method($method === 'GET' ? 'GET' : 'POST')
            ->attributeIf($action, 'action', $action);
    }
226783
public function create($token, $expireTime, $accessToken)
    {
        $this->getConnection()->table('oauth_refresh_tokens')->insert([
            'id' => $token,
            'expire_time' => $expireTime,
            'access_token_id' => $accessToken,
            'created_at' => Carbon::now(),
            'updated_at' => Carbon::now(),
        ]);

        return (new RefreshTokenEntity($this->getServer()))
               ->setId($token)
               ->setAccessTokenId($accessToken)
               ->setExpireTime((int) $expireTime);
    }
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(),
        ]));
    }
88409
public static function createFromToken(TagToken $token) : Tag
    {
        $tagName = $token->getTagName();
        $attribute = $token->getAttribute();
        return new Tag($tagName, $attribute);
    }
860815
protected function newRoleModel($token, array $options = [])
    {
        $role        = new Role();
        $role->token = $token;

        foreach ($options as $key => $value) {
            $role->{$key} = $value;
        }

        return $role;
    }
1320215
public function createSession(Token $token)
    {
        $response = $this->sendInstallationPostRequest(
            '/v1/session-server',
            [
                'headers' => [
                    'X-Bunq-Client-Authentication' => $token->toString(),
                ],
                'json'    => [
                    'secret' => $this->apiKey,
                ],
            ]
        );

        $responseArray = \json_decode((string)$response->getBody(), true);

        return $responseArray['Response'][1]['Token']['token'];
    }
32769
protected function renderToken(Token $token)
    {
        $type = $token->getType();

        // handle edge cases
        switch ($type) {
            case "open":
                return "(";
            case "close":
                return ")";
            case "group":
                return $this->renderGroupBy();
            case "sort":
                return $this->renderSort();
            case "function":
                /** @var Value $token */
                return $this->renderFunction($token);
        }

        if ($token instanceof Entity) {
            return $this->renderEntity($token);
        }
        if ($token instanceof Reference) {
            return $this->renderReference($token);
        }
        if ($token instanceof Value) {
            return $this->renderValue($token);
        }

        return strtoupper($type);
    }
619674
public function setToken($token)
    {
        $token = trim($token);

        $this->isChanged('token', $token);

        $this->token = $token;

        return $this;
    }
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;
    }
202708
public static function create($url, $token)
    {
        $plugins = [
            new Plugin\RedirectPlugin(),
            new Plugin\RetryPlugin(['retries' => 5]),
            new Plugin\DecoderPlugin(),
            new Plugin\ErrorPlugin(),
        ];

        if ($token) {
            $plugins[] = new Plugin\AuthenticationPlugin(new QueryParam([
                'api_key' => $token,
            ]));
        }

        $client        = new PluginClient(Discovery\HttpClientDiscovery::find(), $plugins);
        $streamFactory = Discovery\StreamFactoryDiscovery::find();
        $builder       = new MultipartStreamBuilder($streamFactory);

        return new HttpPlugHttpAdapterClient($client, $url, Discovery\MessageFactoryDiscovery::find(), $builder);
    }
728519
protected function createRoleModel($token, array $options = [])
    {
        $role = $this->newRoleModel($token, $options);
        $role->save();

        return $role;
    }
136859
public function createAction()
    {
        /**
         * @var $form \Zend\Form\Form
         */
        $form = $this->getCreateForm();

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost());

            if ($form->isValid()) {
                $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
                $entity = $this->getEntity();
                $hydrator = new DoctrineHydrator($objectManager);
                $hydrator->hydrate($form->getData(), $entity);
                $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]);
    }
1004637
protected function _get($token = null)
    {
        $token = $this->_token($token);

        $subject = $this->_subject([
            'success' => true,
            'entity' => $this->_table()->newEntity(),
            'token' => $token
        ]);

        $this->_trigger('beforeRender', $subject);
    }