symfony-bundle extradoctrine-bundle
This Bundle include Extra Features for doctrine
appventus/extradoctrine-bundle
This Bundle include Extra Features for doctrine
- Thursday, March 27, 2014
- by lenybernard
- Repository
- 2 Watchers
- 0 Stars
- 235 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 21 % Grown
This bundle gives extra features to doctrine for symfony2, (*1)
Configuration
In your doctrine configuration, add the functions:, (*2)
doctrine:
orm:
dql:
string_functions:
lpad: AppVentus\DoctrineBundle\ORM\Query\AST\Functions\LpadFunction
Usage
Exemple of query builder usage:, (*3)
//we want to have YYYYMM
//so we need to have 2 digits for month
$zeroFillLiteral = $qb->expr()->literal('2');
$yearMonthConcatExpr = $qb->expr()->concat('bill.year', 'LPAD(bill.month,'.$zeroFillLiteral.',\'0\')');