Articles

Symfony, Twig & Doctrine ORMs

The framework this site has the most to say about: Twig templates, Doctrine mappings and queries, forms, and the security bits that changed under everyone.

Five notes on the parts of Symfony, Twig and Doctrine that behave differently from what the documentation first suggests.

Doctrine. Every MySQL tinyint is read as a boolean, whatever its declared length; the post has the full type table and two ways to keep a small integer an integer. Joining entities that have no association works with the WITH join.

Twig. parent() in a child block keeps the inherited content instead of replacing it. Showing the logged-in user needs a different expression than the one most saved snippets use.

Choosing a version. Symfony 7.4 LTS or 8.1 lays out support dates and PHP requirements for a new or existing project.

Everything in Symfony, Twig & Doctrine ORMs

  • Title card: Symfony 7.4 LTS or 8.1: Which Should You Use?

    10/11/2026

    Symfony 7.4 LTS or 8.1: Which Should You Use?

    Symfony 8.1 is the latest stable and 7.4 is the long-term support release. The support dates and PHP requirements, and how to choose for a new or existing project.

  • Doctrine Arbitrary Table Joins on Unassociated Entities

    01/25/2016

    Doctrine: joining entities with no association

    In Symfony using Doctrine, if no association is available for two entities, you can still join them and treat them like they have a relationship. To do so, you have to use the “Join: WITH” method.

  • Diagram: a child template's block calling parent() to keep the base template's stylesheet lines and add its own, against a faint version where they were lost.

    11/30/2015

    Extending a parent Twig block with parent()

    Define a block in a child template and it replaces the parent's version completely - which is rarely what you wanted for a block holding stylesheets or scripts. parent() puts the inherited content back.

  • Conditional User State in Twig Views

    04/28/2015

    Show the logged-in user in a Twig template

    The snippet everyone has saved uses app.user.username, which throws on every supported Symfony. Here is the version that works, which check to guard it with, and how to greet somebody by name rather than by email address.

  • Doctrine ORM MySQL Field Type Definitions

    03/24/2015

    Doctrine field type mappings: tinyint is a boolean

    When Doctrine reads a MySQL schema, every tinyint becomes boolean whatever its declared length. The full type table, and two ways to keep a small integer an integer.