Removing depricated function calls and implementing quote strategy based on http://www.doctrine-project.org/jira/browse/DDC-1845 and https://github.com/doctrine/doctrine2/pull/372