gesdinet / doctrine-functions-psql
Doctrine DQL 函数用于 PostgreSQL
v0.1.0
2014-10-22 10:13 UTC
Requires
- php: >=5.3.0
- doctrine/orm: >=2.2.3
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-09-06 07:15:58 UTC
README
本包包含 PostgreSQL 的 Doctrine 函数。
可用函数列表
DAYOFWEEK(expr)
WEEK(expr)
DAYOFMONTH(expr)
DAYOFYEAR(expr)
HOUR(expr)
MINUTE(expr)
MONTH(expr)
QUARTER(expr)
SECOND(expr)
YEAR(expr)
在您的 pull request 中编辑此文件以将您的函数添加到列表中。
安装
通过 Composer
$ composer require gesdinet/doctrine-functions-psql
用法
1) 仅 Doctrine
根据 Doctrine 文档,您可以通过这种方式注册此包中的函数。
<?php $config = new \Doctrine\ORM\Configuration(); $config->addCustomDatetimeFunction('year', 'Gesdinet\DQL\Datetime\Year'); $em = EntityManager::create($dbParams, $config);
2) 使用 Symfony 2
在 Symfony 2 中,您可以直接在 config.yml
文件中注册您的函数。
doctrine: orm: dql: datetime_functions: month: Gesdinet\DQL\Datetime\Month year: Gesdinet\DQL\Datetime\Year # etc
贡献
请随意提交包含新函数和测试的 PR
鸣谢
基于 luxifer 的 doctrine-functions for MySQL
许可
MIT 许可证 (MIT)。请参阅 许可文件 获取更多信息。