Symfony REST提交无形式发布? [英] Symfony REST submit Post without form?

查看:137
本文介绍了Symfony REST提交无形式发布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否需要使用表单(formbuilder)向Symfony提交POST数据?例如,通过xml登录或类似的东西?



我很困惑,因为有人告诉我我必须,另一方面有一些人告诉我我不需要,因为我将它用作REST api ???



如果我们可以通过使用REST和CRUD的可能性。

我有点困惑,因为在登录的情况下,我不想向表单或实体请求一个请求,或者这是唯一的方法处理例如。登录数据?



感谢您的帮助。 其实我认为这是你自己的选择。没有要求以单一方式做事情。你认为你需要表格 - 使用表格,不 - 不。
我认为如果您的REST API中的行为与任何实体无关,那么绝对没有必要使用表单。但是,如果动作旨在处理CRUD请求(POST或PUT),则使用表单更为方便。但无论如何,这只是您的选择。



在某些情况下(在标准和非常简单的情况下)使用表单更容易,我认为这是制作最好和最快的方式一些工作。但是如果您需要自定义表单,它可能太困难了,可能需要一些时间才能解决所有问题。


Do I need to use a form (formbuilder) to submit POST Data to symfony? For example login by xml or something like that?

I'm confused as there are people telling me I have to, and on the other hand there an some who tell me that I don't need to because I use it as a REST api???

It would be great if we can go through the possibilities I have with REST and CRUD.

I'm a bit confused because in case of a login, I don't want to nind a request to a form or an entity or is this the only way handling eg. login data?

Thanks in advance for your help.

解决方案

Actually I think it's your own choice. There is no requirements to do things in single way. Do you think you need form - use form, no - no. I think if action from your REST API doesn't relate to any entity it's absolutely not necessary to use forms. But if the action is aimed to handle CRUD request (POST or PUT) it's more convenient way to use forms. But anyway it's only your choice.

In some cases (in standard and pretty simple cases) it's much easier to use form and I think it's the best and fastest way to make something work. But if you need to customize form it might be too difficult and might take some time to solve all of the issues.

这篇关于Symfony REST提交无形式发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆