MySQL “Where IN” value contained in list used with setParameter() requires value to be array if using placeholders

In normal SQL queries, you can use “WHERE IN” like this: “WHERE id IN (1,5,10)” as in: If the list 1,5,10 "contains" the value represented by the value in the "id" field. However, if you define a comma delimited string, you can’t simply do this: This will only return the first result!   However, if…

Extending a Symfony parent Twig block in child view’s block with parent() call easy, useful and DRY

Twig blocks are like methods in a class.  If the Twig container is a class, Twig blocks are methods.  So you can call on a parent Twig view and extend the parent just like a function using the "parent()" function like below within the dynamic content tags, which are a pair of squiggly brackets.  Here's…

Setting Twig Global values in your Symfony system decouples hardcoding values like Google Analytics IDs

Here's a handy trick to define things like your Google Analytics ID and domain on a global level then be able to call on those global variables in any Twig template.  This allows you to put unique values, usernames, etc in your config files and even different values in different environments like config_dev.yml. Here's a…

Symfony Assetic Bundle Node resolving common install conflict when dumping assetic assets

A common Symfony issue with a new server deals with Assetic and Node working together.  You can run Symfony without either one, but if you're a fan of Node and want to utilize everything you can like Assetic and LESS, it's worth the extra 20 minutes or so struggling with the proper settings.  As you…

Creating a bootstrap Symfony project

By bootstrapping a Symfony project I am referring to creating a ready-to-go basic software package from which to build any projects from.  This also does include Twitter's awesome Bootstrap libraries as well. New project requires a well-designed database first The first thing I usually do with a new Symfony project is design the database.  I…