naprstek/doctrine-functions

一套用于 Doctrine 2 的用户定义函数,主要用于 MSSQL。

1.2.1 2018-10-11 11:26 UTC

This package is not auto-updated.

Last update: 2024-09-26 16:31:00 UTC


README

Doctrine 2 的扩展集,用于支持 MSSQL 中可用的额外查询函数。

此库受到 DoctrineExpressions 的启发,请参阅此处:[https://github.com/beberlei/DoctrineExtensions]。它包含了许多其他数据库的函数。

命名空间与 DoctrineExtensions 中的命名空间保持一致,因此这两个库可以一起使用。

安装

要安装此库,请运行以下命令,您将获取最新版本

composer require naprstek/doctrine-functions

集成到应用中

在 module.config.php 中向 doctrine 部分添加所需函数的名称。函数不会自动添加(以减少依赖和加快速度)

    'doctrine' => [
        'connection' => [
            'orm_default' => [
                ...
            ],
        ],
        'configuration' => [
            'orm_default' => [ //User Defined Functions
                'string_functions' => [
                    'format' => 'DoctrineFunctions\Query\Mssql\Format',
                    ...
                ],
                'datetime_functions' => [], //when they exist
                'numeric_functions' => [], //when they exist
            ],
        ],
    ],