dukecity / doctrineextensions
A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
Installs: 18 613
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 0
Forks: 432
Open Issues: 9
Requires
- php: ^8.1
- doctrine/orm: ^2.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.38
- nesbot/carbon: ^2.71
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.4
- symfony/cache: ^6.3 || ^7.0
- symfony/yaml: ^6.3 || ^7.0
- dev-master
- 2.x-dev
- v2.0.2
- v2.0.1
- v2.0
- v1.3.0
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.3.0
- v0.2-alpha
- v0.1
- dev-feature/add-BIN_TO_UUID-for-mysql
- dev-feature/Allow_expression_in_DatePart
- dev-feature/allow_stringaggr_to_accept_sub_function
- dev-feature/add-flags-for-regex-replace-postgres
This package is auto-updated.
Last update: 2024-11-19 08:00:41 UTC
README
A set of extensions to Doctrine 2 that add support for functions available in MySQL, Oracle, PostgreSQL and SQLite.
Note: SQLite date functions are implemented as
strftime(format, value)
. SQLite only supports the most common formats, sodate_format
will convert the mysql substitutions to the closest available SQLite substitutions. This meansdate_format(field, '%b %D %Y') -> Jan 1st 2023
becomesstrftime('%m %d %Y', field) -> 01 01 2023
.
Installation
To install this library, run the command below and you will get the latest version:
composer require dukecity/doctrineextensions
Usage
If you are using DoctrineExtensions with Symfony read How to Register custom DQL Functions.
You can find example Symfony configuration for using DoctrineExtensions custom DQL functions in config.
If you are using DoctrineExtensions standalone, you might want to fire up the autoloader:
<?php $classLoader = new \Doctrine\Common\ClassLoader('DoctrineExtensions', '/path/to/extensions'); $classLoader->register();
For more information check out the documentation of Doctrine DQL User Defined Functions.
Motivation
The original repo is not so good maintained anymore. The motivation for this Repo, is to
- add more functions
- improve CodeCoverage and testing (your help is welcome)
- modernize
Credits
Credits and thanks to the original repo and their maintainers. https://github.com/beberlei/DoctrineExtensions
Test and Contributing
If you want to run phpunit:
composer run test
If you want to run php-cs-fixer:
composer run lint
Notes
- MySQL
DATE_ADD
is available in DQL asDATEADD(CURRENT_DATE(), 1, 'DAY')
- MySQL
DATE_SUB
is available in DQL asDATESUB(CURRENT_DATE(), 1, 'DAY')
- MySQL
IF
is available in DQL asIFELSE(field > 0, 'true', 'false')
Troubleshooting
Issues are disabled on this repository, if a custom DQL function that you want isn't provided, or does not support the arguments you want to pass, pull requests are open and we would love to have your contributions.