September 2016
Intermediate to advanced
1091 pages
21h 41m
English
Controllers play a major role in web applications by being at the forefront of any application output. They are the endpoints, the code that executes behind each URL. In a more technical manner, we can say the controller is any callable (a function, method on an object, or a closure) that takes the HTTP request and returns an HTTP response. The response is not bound to a single format like HTML, it can be anything from XML, JSON, CSV, image, redirect, error, and so on.
Let's take a look at the previously created (partial) src/AppBundle/Controller/CustomerController.php file, more precisely its newAction method:
/** * Creates a new Customer entity. * * @Route("/new", name="customer_new") * @Method({"GET", "POST"}) */ public function newAction(Request ...Read now
Unlock full access