beberlei/DoctrineExtensions
Fork: 432 Star: 2040 (更新于 2024-10-30 04:56:07)
license: NOASSERTION
Language: PHP .
A set of Doctrine 2 extensions
最后发布版本: v1.5.0 ( 2024-03-04 01:56:15)
DoctrineExtensions
A set of extensions to Doctrine 2 that add support for functions available in MySQL, Oracle, PostgreSQL and SQLite.
DB | Functions |
---|---|
MySQL | ACOS, ADDTIME, AES_DECRYPT, AES_ENCRYPT, ANY_VALUE, ASCII, ASIN, ATAN, ATAN2, BINARY, BIT_COUNT, BIT_XOR, CAST, CEIL, CHAR_LENGTH, COLLATE, CONCAT_WS, CONVERT_TZ, COS, COT, COUNTIF, CRC32, DATE, DATE_FORMAT, DATEADD, DATEDIFF, DATESUB, DAY, DAYNAME, DAYOFWEEK, DAYOFYEAR, DEGREES, DIV, EXP, EXTRACT, FIELD, FIND_IN_SET, FLOOR, FORMAT, FROM_BASE64, FROM_UNIXTIME, GREATEST, GROUP_CONCAT, HEX, HOUR, IFELSE, IFNULL, INET_ATON, INET_NTOA, INET6_ATON, INET6_NTOA, INSTR, IS_IPV4, IS_IPV4_COMPAT, IS_IPV4_MAPPED, IS_IPV6, JSON_CONTAINS, JSON_DEPTH, JSON_LENGTH, LAG, LAST_DAY, LEAD, LEAST, LOG, LOG10, LOG2, LPAD, MAKEDATE, MATCH, MD5, MINUTE, MONTH, MONTHNAME, NOW, NULLIF, OVER, PERIOD_DIFF, PI, POWER, QUARTER, RADIANS, RAND, REGEXP, REPLACE, ROUND, RPAD, SECOND, SECTOTIME, SHA1, SHA2, SIN, SOUNDEX, STD, STDDEV, STRTODATE, STR_TO_DATE, SUBSTRING_INDEX, TAN, TIME, TIMEDIFF, TIMESTAMPADD, TIMESTAMPDIFF, TIMETOSEC, TRUNCATE, UNHEX, UNIX_TIMESTAMP, UTC_TIMESTAMP, UUID_SHORT, VARIANCE, WEEK, WEEKDAY, WEEKOFYEAR, YEAR, YEARMONTH, YEARWEEK |
Oracle | CEIL, DAY, FLOOR, HOUR, LISTAGG, MINUTE, MONTH, NVL, SECOND, TO_CHAR, TO_DATE, TRUNC, YEAR |
SQLite | CASE WHEN THEN ELSE END, DATE, DATE_FORMAT*, DAY, HOUR, IFNULL, JULIANDAY, MINUTE, MONTH, REPLACE, ROUND, SECOND, STRFTIME, WEEK, WEEKDAY, YEAR |
PostgreSQL | AT_TIME_ZONE, COUNT_FILTER, DATE, DATE_PART, DATE_TRUNC, DAY, EXTRACT, GREATEST, HOUR, LEAST, MINUTE, MONTH, REGEXP_REPLACE, SECOND, STRING_AGG, TO_CHAR, TO_DATE, YEAR |
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.
最近版本更新:(数据更新于 2024-09-16 17:50:53)
2024-03-04 01:56:15 v1.5.0
2024-02-06 05:49:35 v1.4.0
2020-11-29 15:41:08 v1.3.0
2020-11-02 18:59:09 v1.2.9
2020-10-01 13:17:55 v1.2.8
2019-07-25 23:11:28 v1.2.3
2018-09-27 00:19:08 v1.1.5
2018-07-14 17:32:00 v1.1.3
2018-01-27 15:05:39 v1.0.21
2017-12-01 18:03:27 v1.0.20
beberlei/DoctrineExtensions同语言 PHP最近更新仓库
2024-11-01 18:37:36 schmittjoh/JMSSerializerBundle
2024-10-31 21:37:53 filamentphp/filament
2024-10-28 00:16:41 symfony/var-dumper
2024-10-28 00:11:41 symfony/symfony
2024-10-11 23:44:26 coollabsio/coolify
2024-10-11 03:27:29 odan/slim4-skeleton