How-to articles, tricks, and solutions about SYMFONY
Accessing session from TWIG template
In a TWIG template, you can access the session data by using the app.session variable.
artisan migration error "Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found"
This error message is indicating that the PHP extension for PDO MySQL is not installed or not enabled on your system.
Docker MYSQL ' Connection refused'
The ' Connection refused' error in Docker when trying to connect to a MySQL container typically indicates that the MySQL server is not running or is not accessible on the network.
Getting all request parameters in Symfony 2
In Symfony 2, you can use the $request->request object to get all request parameters.
How to access an application parameters from a service?
In PHP, you can access application parameters from a service by injecting the ParameterBag object into the service class constructor.
How to display string that contains HTML in twig template?
To display a string that contains HTML in a Twig template, you can use the raw filter.
How to get the server path to the web directory in Symfony2 from inside the controller?
In Symfony2, you can use the $this->get('kernel')->getRootDir() method inside a controller to get the server path to the web directory.
How to keep symlinks in web/bundles after composer update
When updating vendor through "composer update" or "composer install", the content of "Resources/public" of each bundle is copied into web/bundles. In order to create symlinks you have to make small change in composer.json.
How to programmatically login/authenticate a user
Learn How to programmatically login/authenticate a user with W3docs tutorial. Also, try the examples yourself and see the results