naprstek/doctrine-functions

A set of User Defined Functions to Doctrine 2, basically for MSSQL.

1.2.1 2018-10-11 11:26 UTC

This package is not auto-updated.

Last update: 2024-04-25 14:35:32 UTC


README

A set of extensions to Doctrine 2 that add support for additional query functions available in MSSQL.

This library is inspired by DoctrineExpressions, see here: [https://github.com/beberlei/DoctrineExtensions]. It contains a lot of functions for other DB.

The namespace were preserved as they are in DoctrineExtensions, so those two library can be used together.

DB Functions
MSSQL CAST, FORMAT, ISNULL, GETDATE, MONTH, YEAR, DATEPART

Installation

To install this library, run the command below and you will get the latest version:

composer require naprstek/doctrine-functions

Integration to application

in module.config.php add to doctrine section and name function you need. Functions are not added automaticaly (to decrease dependencies and speed up):

    '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
            ],
        ],
    ],