Failed to write cache file error in Symfony 2.6.1 usually file permissions for cache folders

This error thrown in Symfony 2.6.1 was resolved by going to the app directory of the Symfony site and running the following chmod permission changes.  Make sure you have root permissions! Whoops, looks like something went wrong. 1/1 RuntimeException in ClassCollectionLoader.php line 239: Failed to write cache file "/home/subdomain/public_html/app/dev/cache/classes.php". Note: For the "chmod" command,…

Latest Symfony version with standard Composer dependency settings that won’t break!

The latest and greatest version of Symfony is so fresh, it's just not ready for prime time -- at least some of its standard dependency packages they call bundles!  I hope this saves other Sensio Labs Symfony framework users trouble because if you're hoping for all new versions, you're bound to run into the trouble. …

Symfony Assetic troubleshooting with the LESS filter

Installing Symfony doesn't take long, but depending on your Composer capabilities on your web server, you may run into issues if you don't install LESS and Node properly. Find the Node modules path by typing in the Linux command line: Then set to the node_paths option: To test Assetic and Less together, in command line,…

Example of basic looping through array values in Symfony Twig

Cycle through an array of values for current year and 5 years into the future: The array "colors" would probably be better off defined in the controller then passed into the view here, but here's an example of how to set and initialize a new array in Twig. This can be handy if you…

Setting a Doctrine query limit in Sensio Lab’s Symfony PHP framework for customer queries in respositories

Here is an example of a simple DQL query in a custom repository method meant to return a single array result. The following will return the latest result in case there are multiple contact records that match the "customerId" field, which is actually "customer_id" in the database, but remember that camelCase convention applies to Doctrine…