avkluchko/postgres-doctrine-extensions
Composer 安装命令:
composer require avkluchko/postgres-doctrine-extensions
包简介
Doctrine extensions for working with PostgreSQL database
README 文档
README
Doctrine extensions for working with PostgreSQL database
Requirements
Installation
composer require avkluchko/postgres-doctrine-extensions
Add the necessary extensions in the doctrine.yaml:
doctrine:
orm:
dql:
string_functions:
cast: AVKluchko\PostgresDoctrineExtensions\DQL\Cast
date_part: AVKluchko\PostgresDoctrineExtensions\DQL\DatePart
make_date: AVKluchko\PostgresDoctrineExtensions\DQL\MakeDate
to_char: AVKluchko\PostgresDoctrineExtensions\DQL\ToChar
Usage
// src/Filters/SomeFilter.php public class SomeFilter { // ... protected function createCondition(string $year, string $field, string $operator, string $parameterName): string { return sprintf( 'make_date(%s, cast(date_part(\'month\', %s) as integer), cast(date_part(\'day\', %s) as integer)) %s :%s', $year, $field, $field, $operator, $parameterName ); } }
统计信息
- 总下载量: 339
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-02