From ce17b0e40be4ef5c92d7a0059ce4fd39d3126c3e Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 9 Feb 2024 14:24:18 +0100 Subject: [PATCH] More patches for Doctrine bugs Related: https://github.com/doctrine/orm/issues/11240 Related: https://github.com/doctrine/orm/issues/11241 --- .github/workflows/build.yml | 2 +- compatibility/patches/Base.patch | 13 +++++++++++++ compatibility/patches/DateAddFunction.patch | 10 ++++++++++ compatibility/patches/DateSubFunction.patch | 10 ++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 compatibility/patches/Base.patch create mode 100644 compatibility/patches/DateAddFunction.patch create mode 100644 compatibility/patches/DateSubFunction.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66ab5b7f..6dc4a1e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,7 +112,7 @@ jobs: - php-version: "8.3" dependencies: "highest" update-packages: | - composer config extra.patches.doctrine/orm --json --merge '["compatibility/patches/Column.patch", "compatibility/patches/DiscriminatorColumn.patch", "compatibility/patches/DiscriminatorMap.patch", "compatibility/patches/Embeddable.patch", "compatibility/patches/Embedded.patch", "compatibility/patches/Entity.patch", "compatibility/patches/GeneratedValue.patch", "compatibility/patches/Id.patch", "compatibility/patches/InheritanceType.patch", "compatibility/patches/JoinColumn.patch", "compatibility/patches/JoinColumns.patch", "compatibility/patches/ManyToMany.patch", "compatibility/patches/ManyToOne.patch", "compatibility/patches/MappedSuperclass.patch", "compatibility/patches/OneToMany.patch", "compatibility/patches/OneToOne.patch", "compatibility/patches/OrderBy.patch", "compatibility/patches/UniqueConstraint.patch", "compatibility/patches/Version.patch"]' + composer config extra.patches.doctrine/orm --json --merge '["compatibility/patches/Base.patch", "compatibility/patches/Column.patch", "compatibility/patches/DateAddFunction.patch", "compatibility/patches/DateSubFunction.patch", "compatibility/patches/DiscriminatorColumn.patch", "compatibility/patches/DiscriminatorMap.patch", "compatibility/patches/Embeddable.patch", "compatibility/patches/Embedded.patch", "compatibility/patches/Entity.patch", "compatibility/patches/GeneratedValue.patch", "compatibility/patches/Id.patch", "compatibility/patches/InheritanceType.patch", "compatibility/patches/JoinColumn.patch", "compatibility/patches/JoinColumns.patch", "compatibility/patches/ManyToMany.patch", "compatibility/patches/ManyToOne.patch", "compatibility/patches/MappedSuperclass.patch", "compatibility/patches/OneToMany.patch", "compatibility/patches/OneToOne.patch", "compatibility/patches/OrderBy.patch", "compatibility/patches/UniqueConstraint.patch", "compatibility/patches/Version.patch"]' composer config extra.patches.carbonphp/carbon-doctrine-types --json --merge '["compatibility/patches/DateTimeImmutableType.patch", "compatibility/patches/DateTimeType.patch"]' composer require --dev doctrine/orm:^3.0 doctrine/dbal:^4.0 carbonphp/carbon-doctrine-types:^3 -W diff --git a/compatibility/patches/Base.patch b/compatibility/patches/Base.patch new file mode 100644 index 00000000..9a5f2ace --- /dev/null +++ b/compatibility/patches/Base.patch @@ -0,0 +1,13 @@ +--- src/Query/Expr/Base.php 2024-02-09 14:21:17 ++++ src/Query/Expr/Base.php 2024-02-09 14:21:24 +@@ -33,6 +33,10 @@ + + public function __construct(mixed $args = []) + { ++ if (is_array($args) && array_key_exists(0, $args) && is_array($args[0])) { ++ $args = $args[0]; ++ } ++ + $this->addMultiple($args); + } + diff --git a/compatibility/patches/DateAddFunction.patch b/compatibility/patches/DateAddFunction.patch new file mode 100644 index 00000000..79a7606a --- /dev/null +++ b/compatibility/patches/DateAddFunction.patch @@ -0,0 +1,10 @@ +--- src/Query/AST/Functions/DateAddFunction.php 2024-02-09 14:22:59 ++++ src/Query/AST/Functions/DateAddFunction.php 2024-02-09 14:23:02 +@@ -71,7 +71,6 @@ + private function dispatchIntervalExpression(SqlWalker $sqlWalker): string + { + $sql = $this->intervalExpression->dispatch($sqlWalker); +- assert(is_numeric($sql)); + + return $sql; + } diff --git a/compatibility/patches/DateSubFunction.patch b/compatibility/patches/DateSubFunction.patch new file mode 100644 index 00000000..12a8fcf3 --- /dev/null +++ b/compatibility/patches/DateSubFunction.patch @@ -0,0 +1,10 @@ +--- src/Query/AST/Functions/DateSubFunction.php 2024-02-09 14:22:31 ++++ src/Query/AST/Functions/DateSubFunction.php 2024-02-09 14:22:50 +@@ -64,7 +64,6 @@ + private function dispatchIntervalExpression(SqlWalker $sqlWalker): string + { + $sql = $this->intervalExpression->dispatch($sqlWalker); +- assert(is_numeric($sql)); + + return $sql; + }