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.

Search these 6 posts

Everything in Symfony, Twig & Doctrine ORMs

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

    10/06/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.

  • Diagram: attribute(form, 'field_' ~ i) building a dynamic field name, resolving down to field_1 and field_2, guarded by an is defined check.

    04/14/2015

    Dynamic field names in Twig with attribute() and ~

    Dot notation cannot reach a property whose name you are building in the template. attribute() takes the name as a string, the tilde concatenates it, and `is defined` keeps the loop from throwing on a gap.

  • 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.