appventus/extradoctrine-bundle

This Bundle include Extra Features for doctrine

dev-master 2014-03-27 10:52 UTC

This package is auto-updated.

Last update: 2020-03-09 03:40:40 UTC


README

This bundle gives extra features to doctrine for symfony2

Configuration

In your doctrine configuration, add the functions:

doctrine:
	orm:
    	dql:
        	string_functions:
            	lpad: AppVentus\DoctrineBundle\ORM\Query\AST\Functions\LpadFunction

Usage

Exemple of query builder usage:

//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\')');