Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 Form folder

Tags:

forms

php

symfony

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?

like image 709
Daniel Avatar asked Jul 11 '26 22:07

Daniel


1 Answers

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.
like image 170
Elnur Abdurrakhimov Avatar answered Jul 13 '26 13:07

Elnur Abdurrakhimov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!