morontt / doctrine-functions
Additional DQL functions for Doctrine2
Installs: 3 006
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/morontt/doctrine-functions
Requires
- php: >=5.3.0
- doctrine/orm: >=2.2.3
This package is auto-updated.
Last update: 2025-10-29 01:50:42 UTC
README
Additional DQL functions for Doctrine2
Numeric functions
RAND()ref
Datetime functions
MONTH()ref
String functions
substr(string, from, count)ref
Installation
Just add the package to your composer.json
{
"require": {
"morontt/doctrine-functions": "dev-master"
}
}
Integration
1) Doctrine Only
According to the Doctrine documentation you can register the functions in this package this way.
<?php $config = new \Doctrine\ORM\Configuration(); $config->addCustomNumericFunction('rand', 'Morontt\DQL\Numeric\Rand'); ?>
2) Using Symfony 2
With symfony 2 you can register you functions in the config.yml file.
doctrine: orm: entity_managers: default: dql: numeric_functions: rand: Morontt\DQL\Numeric\Rand datetime_functions: month: Morontt\DQL\DateTime\Month string_functions: substr: Morontt\DQL\String\Substr