See http://stackoverflow.com/questions/12764182/how-to-get-entity-manager-for-doctrine-entity-with-symfony-2-1-from-inside-contr