Symfony tutorial: Embed a Collection of Forms
HTML-код
- Опубликовано: 17 май 2018
- WATCH THE VIDEO AT A HIGHER SPEED ITS MUCH BETTER.
Okay In this symfony 3 tutorial i went through how you can embed a collection of forms, which simply means including a form within a form if that makes any sense to you, and here's what this video covers basically:
- Configuring your symfony application to use sqlite instead of mysql.
- Using bootstrap as a theme for Twig templating engine.
- Creating entities and relationships in Doctrine 2.
- Creating forms that the user can interact with.
- Javascript and jQuery which help us generate and remove forms dynamically.
There was a lot of editing on this video because debugging was taking so much time and i didn't want to make the video any longer.
Timestamps:
- Demo and setting up the app and stuff
- JS part starts at: 33:36
- Database persistence starts at:01:09:18
- Back to the JS starts at: 01:15:20
Github project:
github.com/konshensx16/embed-...
This video was very useful for my studies with Symfony embedded forms.
No need to apologize for the duration of the video.
The Symfony documentation on the subject does not provide many details. You amplified this documentation, which helped me clarify several points, especially regarding the use of jQuery.
It takes a lot of confidence to run a tutorial like this and fix the bugs as they appear. You gave a perfect live demonstration of what happens in the everyday life of a true developer. Congratulations.
I hope you continue to perfect your skills. Never stop sharing your knowledge with the community, since you have a gift for it. Thank you very much!
Hello there Eduardo,
The problem with the video duration is that it kind of drives people away when they see an hour and a half long video, it's not like I'm mad because they're not going to watch it there for not a lot of views for me, but I wish there was a way to tell them this is the best I could do it because of all of thing you have to explain, but anyways .
I want to say thank you for taking the time to write such an motivational comment, this is so nice if you and I appreciate it so much, I wish you the best of luck .
Cheers mate :)
I've been struggling with my project for days and this video was very helpful, thank you so much !
You're most welcome soukaina .
Cheers and good luck to you :)
just found tihs video and you were an amazing help. I had to struggle with the entities and setters but in the end figured it out. You deserve a thumps up and subscription
Glad it was helpful mate, thanks
This guy is a legend!
Lol thanks man
Thanks for the video, was trying to make sense of this and your video really helped. Very good details in all your explanations.
I'm glad that was helpful to you mate .
Cheers :)
Thanks for the great video! Keep up the good work!
Thank you for the comment mate .
Cheers :))
Thank you so much for this tutorial!
Very nice tutorial !!! proud being from the same country as this guy ;-)
Ayeee thanks man :)
Thank you for this vide, it was really helpful for me even it is too long
ty bro, it was very useful for me :)
Nice tutorial!
AMAZING !!!!
thank u very much !
Great video. Can you explain how install database and project for beginners ?, thank you
you saved me ! @@@
Sir, i want to insert multiple experiences for new entry. How it possible, please help me.
thank you !
You're welcome :)
Hey man very great video i followed all the steps but i always get this error when i submit "Expected argument of type "App\Entity\Formule", "array" given at property path "formules"."
Merci ! ce tutoriel m'ayant bien aidé :)
Thank you so much..
You're most welcome Roy .
Cheers :))
i am creating a music database app
song entity and artist entity have many tot many relationship
when i add song i have embedded artist form and used cascade persist to automatically insert new artist in artist table and add a song_artist mapping
but when i want to insert new song with same artist name then it inserts the artist with the same name in new row and creates a new mapping in song_artist table.
what i want is that when i add a song existing artist then it should not insert new row in artist table but add new row in song_artist mapping table with new song and existing artist.please anyone help me . i am using symfony 4.2
Thanks for another helpful video. I don't mind learning from your small mistakes :-) Now I just have to transfer this to many to many relations with additional data in the join table. Did you already do a video about that? Cheers
Hello there Stefan,
Sorry if I made you watch me debug lol, I think I made one video that contains like very basic many to many relationship it was about creating a custom type. It was one of my first videos I don't even remember the title . Maybe just custom types
@@OverSeasMedia thanks, I think I just started watching it :-)
Alright man good luck and don't hesitate to ask me any questions if you have any (I might take a long time to answer I can't handle everything that's going on right now lol)
thank you very much, can you tell me what linux distribution are you using, and which interface is that, I suscribe.
Wow bro that was a straight bribe , lol just kidding mate .
The Linux distribution that I'm using is just Ubuntu . The one in the video is 16.04 the theme i was using for Ubuntu was flatbulous (I probably butchered the name lol), as for phpStorm o think that's the "brogrammer" color scheme.
Please let me know if those are not the correct things so I can check again.
Cheers mate :)
@@OverSeasMedia awesome dude, thank you
You're most welcome :)
hello i have an existing symfony project when i try to run it it gave this error [Symfony\Component\Debug\Exception\ContextErrorException]
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Please Help !
Sir please upload video for multiple uploading in sonata admin panel using sonata media bundle
the new symfony is 4 is it possible to use a login form with it ?
Yes of course you can, check the documentation for that they have a section for that.
Thank you for this video!
I have been working on some student project and everything goes well after seeing this video. But when I code this: e('html_attr') after the data-prototype my form won't be displayed in my template. Is there a solution for this? Or perhaps some tip?
Hello there mate,
The "e" filter means espace, and in this case what we are telling is that we don't want to render the html raw we just want it as test, so that it does not interfere with the parent form, is this case you are having or something else is wrong?
@@OverSeasMedia
Thank you for this quick response! So I have been looking at my code and I don't see anything wrong.
This is my twig template:
{% for row in form.client %}
{{ form_row(row) }}
{% endfor %}
This is my form:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('kamer', EntityType::class, [
'class' => Kamer::class,
'expanded' => true,
'label' => false,
'required' => true,
])
->add('aankomst', DateType::class, [
'widget' => 'single_text',
'required' => true,
])
->add('vertrek', DateType::class, [
'widget' => 'single_text',
'required' => true,
])
->add('client', CollectionType::class, [
'entry_type' => ClientForm::class,
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
]);
}
This is my controller:
/**
* @Route("/reservatie", name="app_reservatie")
*/
public function index(Request $request, EntityManagerInterface $em)
{
$form =$this->createForm(ReservatieForm::class);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()){
/** @var Reservatie $reservatie */
$reservatie = $form->getData();
$em->persist($reservatie);
$em->flush();
}
return $this->render('reservatie/index.html.twig', [
'controller_name' => 'ReservatieController',
'form' => $form->createView(),
]);
}
Is there anything that you can see where I missed something?
Thanks alot!
Greetings from Belgium
I download you repository but i don't how to run into in my local system. Iam using xampp server in my local can you help me ?
Hello there mate .
The process is really simple just out this file in your htdocs and then access the application just like I did in the video using the same route, of course you still have to change the database parameters to match your computer and run the migrations to create and update the database schema.
Sir make videos about Symfony 3.4 from Scratch. Its Tough to understand the Docs
Thanks we need tutorials events & services
Yoire most zelcome . I'll see what I can do about that :)
I look for solr bundle which one should I need to use?
Hey Kumar, i actually never got the chance to use any of that, so you just see whatever suits you better and do the job for you, if you got confused,just look for the most popular one and see how it goes .
Yes, this video was and is still very useful to me, but please, can you make a similar video in symfony 4?
Please, i really need your help in that.
thanks a lot OverSeas Media!
Hey Solomon . This video would work also for symfony 4 . The only thing that is different is the structure of the folders and not using bundles, the code is the same
@@OverSeasMedia
Ok let me try it out.
i will let you know how it goes.
Much thanks.
I used this video as a guide in symfony 4, you can try it!
good tutorial , i have a problem with symfony forms , i want to show one form for each post of a users but i write the form into the for and it is not repeated , how i do it ?
Hey there Heath,
Could you please explain what do you mean by creating a form for each post ? do you mean like having a single page displaying like 10 posts and below each post there's a form ? is that what you mean, if no please elaborate more on the idea, thanks :))
exactly that , it's a comments systems , i try to do this :
{% for post in posts %}
{{posts.user.username}}
{{posts.text}}
{{form(form)}}
{% endfor %}
i can't see your answer , can you send again ?
+1
34:15
26:51 dump() in hmtl.twig
after JS frameworks symfony is seems like a nightmare
ruclips.net/video/3kMlvIOSnhk/видео.html - та же тема на русском