Symfony2: kernel.request priority

I recently had to implement a few handlers and listeners in a symfony2 project that lead to the following problems:

Exception Handler was not called
Solution was to give my ExceptionHandler a priority > 0 like this:

A listener got a request that has no route (_route) set
According to the Profiler, my listener was called BEFORE the RouterListener. The RouterListener is called for an “early” and a “normal” routing.
Solution was to give my listener a negative priority, so it will be called AFTER the RouterListener that sets the _route parameter.

If you want/need to dive deeper into the dependency injection, check out this page that documents the default listeners and their priorities:
http://symfony.com/doc/2.0/reference/dic_tags.html

PHP: Check if PID is running

I needed to write a small function, that can check if a specific PID is running an linux/unix system.

Check it out on Gist: https://gist.github.com/3096556

Symfony2: Doctrine github Repos moved from symfony to doctrine

Today i tried to run php bin/vendors install and got this output:

and this:

You have to change dour deps file like this to resolve the problem:

old:

new:

Official change:
https://github.com/doctrine/DoctrineFixturesBundle/commit/479f10d068bd0b01e055aa2f555946893322b79c

PHP: Remove “empty” elements from Array

I recently read more about functional programming and found some functions in PHP that tend in that direction.

Like this function that removes all empty entrys from a array:

To understand what array_filter does, have a look at this version with foreach():

Symfony 2: Using SQLite as Database

I tried using SQLite3 with Symfony 2 and Doctrine but it did not work at first. You need to add another config value because the sqlite driver needs to know the “path” of the datebase. For me it only worked when name == path.

parameters.ini

config.yml