Sign up, sign in, add to cart, checkout, all of these and more are actions that make use of HTML forms in web shop applications and beyond. Building forms is one of the most common tasks for developers. One that often takes time to do it right.
Symfony has a form
component through which we can build HTML forms in an OO way. The component itself is also a standalone library that can be used independently of Symfony.
Let's take a look at the content of the src/AppBundle/Entity/Customer.php
file, our Customer
entity class that was auto-generated for us when we defined it via console:
class Customer { private $id; private $firstname; private $lastname; private $email; public function getId() { return $this->id; } public function setFirstname($firstname) { $this->firstname = $firstname; return $this; } public function getFirstname() { return $this->firstname; } public function setLastname($lastname) { $this->lastname = $lastname; ...