Custom error pages in Symfony

We all know the annoying guy in the image. It tells us that something went terribly wrong. In order to see him as little as possible, I have become a control freak : I check everything in the Controller. Even the things that I know are not supposed to happen. But if someone tampers with some data in the database and those never-to-happen things do occur ? I mean, everyone has seen famous mysql errors on big important websites. So bad data does happen. So in order to handle all my this-code-should-not-be-reached tests gracefully, I have a custom made error page. Read More

Twig Macros

Macros are to Twig what functions are to PHP. They help the developer reuse certain repeatable elements, and they give an additional clean and organized look to the final code. So here is a quick an easy Macro tutorial for Twig.

Aims of this tutorial :

  • Create a simple twig macro
  • Include it and use it in a template
  • Create a second macro that makes use of the first one

Read More