oro/doctrine-extensions
Adds extra Doctrine DQL functions and field types for MySQL and PostgreSQL (e.g., DATE/TIME, TIMESTAMPDIFF, CONVERT_TZ, DAY/WEEK/MONTH, MD5). Includes registration examples for common frameworks and guidance for extending platforms/functions.
Restricts the target type of the CAST DQL function to the supported type names and to a numeric
length or precision, so a query expression can no longer place arbitrary text into the type position
of the generated SQL.
What is changed
CAST expression is accepted only when its target type is one of the documented type names. A name that merely begins with a supported one, such as timestamp or int8, is now rejected as unsupported.CAST(expr as char(5)) and CAST(expr as decimal(10, 2)) keep working and any other content is reported as a syntax error.jsonb is a supported type name in its own right, so a cast to it is accepted and renders as it did before.CAST(expr as string(12)) produces varchar(12) on PostgreSQL and char(12) on MySQL instead of being passed through unchanged.Impact
timestamp, timestamptz, int8) now get a syntax error and have to use one of the supported type names.doctrine/orm 2.8 with doctrine/lexer 1 and doctrine/dbal 2.12, which is the combination OroPlatform 4.2 is fixed to.This major release brings full compatibility with Doctrine ORM 3.0, representing a significant modernization of the library to support the latest PHP and Doctrine ecosystem standards.
The following method signatures have been updated. If you have created custom functions by extending library classes, you may need to update your code:
FunctionFactory::create(string $platformName, string $functionName, array $parameters): PlatformFunctionNodeCast#checkType($type) has been replaced with isSupportedType(string $type): boolTimestampDiff#checkUnit($unit) has been replaced with isSupportedUnit(string $unit): boolAbstractTimestampAwarePlatformFunctionNode#getTimestampValue($expression, SqlWalker $sqlWalker): stringIf you only registered the functions and types provided by this library with Doctrine, most likely you do not need to make any changes to your code. Simply update your composer.json:
{
"require": {
"oro/doctrine-extensions": "^3.0"
}
}
This release was made possible by the Oro team and community contributors who worked to ensure compatibility with Doctrine ORM 3.0. Special thanks to all who tested the alpha and beta releases.
If you encounter any issues with this release, please report them on our GitHub Issues page.
Full Changelog: https://github.com/oroinc/doctrine-extensions/compare/2.0.5...3.0
Full Changelog: https://github.com/oroinc/doctrine-extensions/compare/3.0-alpha4...3.0-beta1
Full Changelog: https://github.com/oroinc/doctrine-extensions/compare/2.0.4...2.0.5
Full Changelog: https://github.com/oroinc/doctrine-extensions/compare/3.0-alpha3...3.0-alpha4
Full Changelog: https://github.com/oroinc/doctrine-extensions/compare/3.0-alpha2...3.0-alpha3
Updated composer.json
In this release will be introduced compatibility with latest versions of Doctrine Moved to latest PHPUnit
Fixed Issue #78 Error when using DATE_FORMAT when used with PHP 8
Fixed Issue #78 Error when using DATE_FORMAT when used with PHP 8
Fixed Issue #78 Error when using DATE_FORMAT when used with PHP 8
Version 2.0.0 requires:
If you just registered the functions and types provided by this library with Doctrine then most likely you do not need to make any changes in your code.
If you have created your own custom functions or types by extending any classes from this library, or if you work with these functions and types directly from your PHP code, then you may need to update your code. Check the upgrade instructions in UPGRADE.md for details.
Usage in DQL CAST(value as binary). Will produce next SQL:
CAST(value as binary)CAST(value as bytea)Minimum PHP version update to 5.4
Usage in DQL CAST(value as binary). Will produce next SQL:
CAST(value as binary)CAST(value as bytea)Minimum PHP version update to 5.4
The DATE_FORMAT() function formats a date as specified by a format mask.
Note! Starting this release new features will be with minor version change
Fixed issue #19
Added CAST to JSON on supported platforms, for others will be casted as string
Added CONCAT_WS support
How can I help you explore Laravel packages today?