Symfony2表单文件夹 [英] Symfony2 Form folder

查看:130
本文介绍了Symfony2表单文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个表单类,我在 http: //symfony.com/doc/current/book/forms.html



我试图在src / Acme / TaskBundle / Form / Type / TaskType.php,但是当我查看我的项目中的文件夹结构时,没有Form文件夹。



我尝试手动创建Form文件夹,在src / Acme / TaskBundle /中,我在Form文件夹和TaskType.php文件(命名空间Acme\TaskBundle\Form\Type Expected:Identifier)。



有没有办法以自动方式创建Form文件夹?或者我该如何手动创建?

解决方案

Form 文件夹只是一个惯例 - 你可以把你的表格放在任何你想要的地方。该约定可以扩展为:


  • 表单类型的Form \ Type li>
  • Form \Model for 表单模型
  • Form \Handler 对于表单处理程序,

  • 等。


I need to create a form class,I'm following the symfony book in http://symfony.com/doc/current/book/forms.html

I am trying to create a form in src/Acme/TaskBundle/Form/Type/TaskType.php, but when I look at the folder structure on my project there is no "Form" folder.

I try to create the Form folder manually, in src/Acme/TaskBundle/, I get an error in the the Form Folder and in the TaskType.php files ( namespace Acme\TaskBundle\Form\Type Expected:Identifier).

Is there a way to create the Form folder in an automatic way? Or how can I create in manually?

解决方案

The Form folder is just a convention — you can put your forms wherever you want. The convention extends to:

  • Form\Type for form types,
  • Form\Model for form models,
  • Form\Handler for form handlers,
  • etc.

这篇关于Symfony2表单文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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