/ TechAdemy Founder of the Dutch Web Alliance. Author of “Mastering the SPL Library” Blog: http://adayinthelifeof.nl Email: [email protected] Twitter: @jaytaph TechAdemy.nl
17 - 24 june & 1 july ➡ 300 euro early bird, 400 euro normaal ➡ https://www.eventbrite.nl/e/tickets- introductie-symfony2-webinar- nederlands-11668148747 3 Symfony2 introduction webinar
public function indexAction($name) { return $this->render('NoxlogicGuestbookBundle:Default:index.html.twig', array('name' => $name)); } } Template name Format Engine Parameters This template can be found at: /src/Noxlogic/GuestbookBundle/views/Default/index.html.twig 18
‘id’: user.id }) }}”> {{ user.name | capitalize }}</a> {% endfor %} <a href=”{{ url(‘homepage’); }}>Go back to the homepage</a> Use path() for relative URLs Use url() for absolute URLs 21
AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name'); $builder->add('email', 'email'); $builder->add('comment', 'textarea'); } public function getName() { return 'comment'; } } src/Noxlogic/GuestbookBundle/Form/ CommentType.php 24 Move the form to its own class
Controller { public function indexAction() { $form = $this->createForm(new CommentType()); return $this->render('NoxlogicGuestbookBundle:Comment:index.html.twig', array('form' => $form->createView())); } } src/Noxlogic/GuestbookBundle/Controller/CommentController.php 25 Keeps the controllers small and clean.