How to install Doctrine Extensions in a Symfony2 project

There also is a nice fork by wiredmedia of @beberlei which includes even more datetime_functions like DATE() itself:

This is an unsanctioned fork of https://github.com/beberlei/DoctrineExtensions since he seems to have gone off grid and is not merging pull requests.

Unfortunately Version 0.1 just includes the fork and not all the functions. We are waiting for a stable release:

Please create taged stable version for set in my composer #2

But you can add them manually unitl a stable version is out.


You can install it via composer. Just add it to your composer.json and then php composer.phar update beberlei/DoctrineExtensions

"beberlei/DoctrineExtensions": "*",

Then you can register functions to your ORM

doctrine:
    orm:
      auto_generate_proxy_classes: %kernel.debug%
      entity_managers:
        default:
          auto_mapping: true
          dql:
            datetime_functions:
              MONTH: DoctrineExtensions\Query\Mysql\Month
              YEAR: DoctrineExtensions\Query\Mysql\Year