symfony3

Topics related to symfony3:

Getting started with symfony3

This section provides an overview of what symfony3 is, and why a developer might want to use it.

It should also mention any large subjects within symfony3, and link out to the related topics. Since the Documentation for symfony3 is new, you may need to create initial versions of those related topics.

Routing

It's useful to see what is generated by Symfony framework, this one provide tools to watch all routes of an specific application.

From the Symfony Doc, use (in a shell) :

php bin/console debug:router

As well, you can watch all the relevant routes informations in the Framework profiler, in the routing menu : Symfony Profiler

Testing

Declaring Entities

Event Dispatcher

  • It is often best to use a single instance of EventDispatcher in your application that you inject into the objects that need to fire events.
  • It is best practice to have a single location where you manage the configuration of, and add event listeners to, your EventDispatcher. The Symfony framework uses the Dependency Injection Container.
  • These patterns will allow you to easily change your event listeners without needing to change the code of any module that is dispatching events.
  • The decoupling of event dispatch from event listener configuration is what makes the Symfony EventDispatcher so powerful
  • The EventDispatcher helps you satisfy the Open/Closed Principle.

Dynamic Forms

Asset Management with Assetic

The folder for the publicly accessible assets in a standard Symfony3 project is "/web". Assetic uses this folder as root folder for the assets.

Validation

In fact, form validation is based from a component, named "Validator Component".

You can often use the dedicated service if you did't have to show a form in a template. Like APIs. You may validate datas in the same way, like this :

For example, based on symfony doc :

$validator = $this->get('validator');
$errors = $validator->validate($author);

if (count($errors) > 0) {
    /*
     * Uses a __toString method on the $errors variable which is a
     * ConstraintViolationList object. This gives us a nice string
     * for debugging.
     */
    $errorsString = (string) $errors;
}

Working with Web Services

Configuration