beberlei / doctrineextensions
A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
Installs: 55 776 127
Dependents: 165
Suggesters: 11
Security: 0
Stars: 2 044
Watchers: 55
Forks: 432
Requires
- php: ^7.2 || ^8.0
- doctrine/orm: ^2.19 || ^3.0
Requires (Dev)
- doctrine/annotations: ^1.14 || ^2
- doctrine/coding-standard: ^9.0.2 || ^12.0
- nesbot/carbon: ^2.72 || ^3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^8.5 || ^9.6
- squizlabs/php_codesniffer: ^3.8
- symfony/cache: ^5.4 || ^6.4 || ^7.0
- symfony/yaml: ^5.4 || ^6.4 || ^7.0
- vimeo/psalm: ^3.18 || ^5.22
- zf1/zend-date: ^1.12
- zf1/zend-registry: ^1.12
- dev-master
- v1.5.0
- v1.4.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
This package is auto-updated.
Last update: 2024-11-26 08:01:44 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 2015
becomesstrftime('%m %d %Y', field) -> 01 01 2015
.
Installation
To install this library, run the command below and you will get the latest version:
composer require beberlei/doctrineextensions
If you want to run phpunit:
composer run test
If you want to run php-cs-fixer:
composer run lint
Usage
Symfony
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.
Standalone
If you are using DoctrineExtensions standalone, you need to register the custom function in the ORM configuration. For more information check out the documentation of Doctrine DQL User Defined Functions.
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.