appventus / extradoctrine-bundle
此包已被废弃,不再维护。未建议替代包。
此Bundle为doctrine提供额外功能
dev-master
2014-03-27 10:52 UTC
Requires
- php: >=5.3.0
- symfony/framework-bundle: >=2.3
This package is auto-updated.
Last update: 2021-12-21 22:35:03 UTC
README
此bundle为symfony2的doctrine提供额外功能
配置
在您的doctrine配置中,添加以下功能
doctrine:
orm:
dql:
string_functions:
lpad: AppVentus\DoctrineBundle\ORM\Query\AST\Functions\LpadFunction
使用方法
查询构建器的使用示例
//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\')');