Tag
Symfony Tips
4 posts tagged Symfony Tips.

04/02/2015
How to show or access cookie values in Symfony Twig views
Strange how obscure it is to find a clear example of how to just access or show the value of a cookie in Twig, so here it is!

03/24/2015
Doctrine field type mappings: tinyint is a boolean
A MySQL tinyint is mapped to boolean regardless of its declared length, so a column holding 0 to 100 comes back as true. The full type table, and the two ways to get an integer back.

01/01/2015
Reading the current locale in Symfony
The locale lives on the Request, not in a global. How to reach it from a controller, from a service that has no request, and from a template - and where it is set before any of that.

01/01/2015
Limiting a Doctrine query with setMaxResults
Here is an example of a simple DQL query in a custom repository method meant to return a single array result. The following will return the latest result in case there are multiple contact records that match the…