Book Image

Extending Symfony2 Web Application Framework

By : Sebastien Armand
Book Image

Extending Symfony2 Web Application Framework

By: Sebastien Armand

Overview of this book

Table of Contents (13 chapters)

Chapter 3. Forms

Symfony ships with a powerful form component. Building forms based on your classes, keeping the data in sync between a form and an object or any data structure, is a complicated topic. There are a few abstractions to understand how the form component works in order to enable its full power and make complete use of it.

One of the good things about it is that almost everything, once defined, is easily reusable. In the previous chapters, we were building a website that allows users to publish or join meetups. We stated at the outset that we wanted to show users only those meetups that are happening with a certain distance from them. For this, we had to know the actual location of each meetup and user. For users, we relied on their IP address, but for meetups, we should probably let the organizer define the exact address—maybe even on a map. There is no map input predefined in the form framework, so we will define one. It should be easy enough to reuse the same input in the user...