0

I have this simple Type Class

class XXXXType extends AbstractType
{
    /**
     * Build form method
     * 
     * @param FormBuilderInterface $builder Builder interface
     * @param array                $options Options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('XXX', 'integer');
    }

    /**
     * Set default options to the type
     * 
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'csrf_protection' => false
        ));
    }

    /**
     * Get type name
     * 
     * @return string
     */
    public function getName()
    {
        return '';
    }
}

and my controller

/**
 * Create a new XXXX
 * 
 * @param Request $request Action Request
 * 
 * @Route("/XXXX")
 * @Method({"POST"})
 * 
 * @ApiDoc(
 *  resource=true,
 *  description="XXXXX",
 *  input="XXXType"
 * )
 */
public function setXXXXXXAction(Request $request)
{
    $form = $this->createForm(new XXXType());
    $response = new JsonResponse();
    $form->submit($request);
    if ($form->isValid()) {
        return $response->setStatusCode(201);
    }

    return $response
            ->setData(array('Message' => $form->getErrorsAsString(0)))
            ->setStatusCode(500);
}

Always I'm receiving the same error from the form:

"ERROR: The uploaded file was too large. Please try to upload a smaller file.\XXX:\n No errors\n

4

1 回答 1

0

是 symfony2.3 上的一个 bug

固定在那里:https ://github.com/symfony/symfony/pull/9048

于 2013-09-16T09:26:36.413 回答