We locked dependencies on Symfony 3.1 for this course, so if you want to code along with this tutorial - you have a few options: - Download course code, go to the start/ directory and manually upgrade dependencies to Symfony 4.x - but most probably you will faced some BC breaks that you will need to fix; - Or, start with the new symfony 4 project and copy/paste parts of codes from this tutorial to it, i.e. you'll need to migrate all the features we have on the beginning of this tutorial.
Probably, the first one is easier if you want to code along with us on our project. The 2nd option is good if you already have a Symfony 4 project and want to practice this course on it.
Well, there's the 3rd option, but you'd need to wait. We're going to release the same topic for Symfony 4 track, but I can't tell you any estimations for now, probably it can takes months.
That's a good question, I haven't found documentation about form naming standards, but here in Knp, we like to put inside "src/AcmeBundle/Form/Type/" all forms binded to an entity, and name them as "EntityNameType.php". If your form is not binded to an entity, then it can live at the root Form folder
Good answer thanks! One question regarding it, you wrote: "we like to put inside "src/AcmeBundle/Form/Type/" all forms binded to an entity, and name them as "EntityNameType.php"."
So LoginForm and RegistrationForm are binded to the Entity User ('data_class' => User::class,) so they have to be in /Form/Type/LoginFormType.php and /Form/Type/UserRegistrationType.php as by this rule, do I understand that correctly?
Also, you could name your UserRegistrationType as RegistrationType, unless you have multiple registrations and need to be more specific.
Please, log in to vote for this comment
|
Share Comment
"Houston: no signs of life" Start the conversation!
This tutorial is built on Symfony 3 but form theming hasn't changed much in Symfony 4 and Symfony 5. Other than some path differences - this tutorial should work fine.
9 Comments
Is there a way I can use the course code in symfony 4 so I can go through the tutorial?
Hey Daniel,
We locked dependencies on Symfony 3.1 for this course, so if you want to code along with this tutorial - you have a few options:
- Download course code, go to the start/ directory and manually upgrade dependencies to Symfony 4.x - but most probably you will faced some BC breaks that you will need to fix;
- Or, start with the new symfony 4 project and copy/paste parts of codes from this tutorial to it, i.e. you'll need to migrate all the features we have on the beginning of this tutorial.
Probably, the first one is easier if you want to code along with us on our project. The 2nd option is good if you already have a Symfony 4 project and want to practice this course on it.
Well, there's the 3rd option, but you'd need to wait. We're going to release the same topic for Symfony 4 track, but I can't tell you any estimations for now, probably it can takes months.
Cheers!
A Donald Trump reference? Really?
The forms are going to be HUUUUGE!
No political preference or allegiance in any direction intended - just having some fun :)
Lol. Well played
Whats the best practice naming convention for Form/* files?
Iam *confused*, some forms are named NAMEForm.php and some are NAMEFormType.php
When should I use *FormType.php and when Form.php?
Hey Mike P.!
That's a good question, I haven't found documentation about form naming standards, but here in Knp, we like to put inside "src/AcmeBundle/Form/Type/" all forms binded to an entity, and name them as "EntityNameType.php". If your form is not binded to an entity, then it can live at the root Form folder
I hope it helps you :)
Cheers!
Good answer thanks!
One question regarding it, you wrote: "we like to put inside "src/AcmeBundle/Form/Type/" all forms binded to an entity, and name them as "EntityNameType.php"."
So LoginForm and RegistrationForm are binded to the Entity User ('data_class' => User::class,) so they have to be in /Form/Type/LoginFormType.php and /Form/Type/UserRegistrationType.php as by this rule, do I understand that correctly?
Yes, exactly that!
Also, you could name your UserRegistrationType as RegistrationType, unless you have multiple registrations and need to be more specific.
"Houston: no signs of life"
Start the conversation!