44 articles Symfony, Twig, Doctrine & ORMs

Symfony & Twig: Simple month and year form selection widget

This is a very useful Twig that I use in a lot of different forms.  I attach a listener and when they click "Update" it will redirect the user by appending the URL with the /year/month to hook nice and cleanly in built-in routes to pass the year and month into different controllers.  

Symfony & Doctrine: Using table joins with unassociated entities

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.  Here's an example query to illustrate, notice the "a.user = u.id". Some other helpful links on Stack Overflow:…

PHP Symfony Events: Developer tips to easily extend user administration and management within your code

A special thanks to James Halsall for some excellent tips in tapping into Symfony events through kernel listeners. His article explains how to create a service to trigger on certain events, this is related to the FOS User Bundle but the same pattern applies to most events in your Symfony project.  Click here to read…

In Symfony, moving some code from one bundle to another a simple way to modularize your code, reuse and scale. Oh yeah!

I recently ran into an issue where I found I was creating a new user profile system for different systems and then it occurred to my:  DRY.  DON'T REPEAT YOURSELF.  Yet, in the bustle of activity I realized there was too much in common with these user profiles to rewrite the code. So why not…

Check if Symfony PHP session has been started

Here's how you can check if a session in Symfony was started: Not a big fan of session variables, but used for non-sensitive session data, I think sessions are still useful.  After all, if you only want certain behaviors on your website tailored to a customer apply only while their browser is open on…