From fafc5b96c10d94f1a9dc849515f708404d634478 Mon Sep 17 00:00:00 2001 From: Thibault Buathier Date: Thu, 18 Apr 2024 19:38:17 +0200 Subject: [PATCH] fix: ci error --- .github/workflows/ci.yml | 16 +++++----------- src/Oro/ORM/Query/AST/FunctionFactory.php | 23 +++++++++++++++++++++-- tests/config/mysql.phpunit.xml | 4 ++-- tests/config/pgsql.phpunit.xml | 4 ++-- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b6fb7e3d7a..1d79d717855 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ name: CI on: [push, pull_request] jobs: - build: + test: runs-on: ubuntu-latest strategy: matrix: php: [8.1] - db_image_name: [mysql, mariadb, percona, postgres] + db_image_name: [mysql, percona, postgres] include: - db_image_name: mysql db_image_version: 8 @@ -16,12 +16,6 @@ jobs: vars: '-e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ROOT_PASSWORD=travis' db_port: 3306 health: '--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10' - - db_image_name: mariadb - db_image_version: 11 - db: mysql - vars: '-e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ROOT_PASSWORD=travis' - db_port: 3306 - health: '--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10' - db_image_name: percona db_image_version: 8 db: mysql @@ -30,16 +24,16 @@ jobs: health: '--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10' - db_image_name: postgres db_image_version: 15 - db: mysql + db: pgsql vars: '-e POSTGRES_DB=doctrine_extensions_tests -e POSTGRES_USER=travis -e POSTGRES_PASSWORD=travis' health: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5' db_port: 5432 services: database: - image: ${{ matrix.db_image }} + image: ${{ matrix.db_image_name }}:${{ matrix.db_image_version }} ports: - - ${{ matrix.db_port }}:{{ matrix.db_port }} + - ${{ matrix.db_port }}:${{ matrix.db_port }} options: >- ${{ matrix.vars }} ${{ matrix.health }} diff --git a/src/Oro/ORM/Query/AST/FunctionFactory.php b/src/Oro/ORM/Query/AST/FunctionFactory.php index b6ba3f4d1f7..ca8bef268b2 100644 --- a/src/Oro/ORM/Query/AST/FunctionFactory.php +++ b/src/Oro/ORM/Query/AST/FunctionFactory.php @@ -3,6 +3,9 @@ namespace Oro\ORM\Query\AST; +use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\ORM\Query\QueryException; use Oro\ORM\Query\AST\Platform\Functions\PlatformFunctionNode; @@ -13,8 +16,24 @@ class FunctionFactory * * @throws QueryException */ - public static function create(string $platformName, string $functionName, array $parameters): PlatformFunctionNode - { + public static function create( + AbstractPlatform $platform, + string $functionName, + array $parameters + ): PlatformFunctionNode { + if ($platform instanceof PostgreSQLPlatform) { + $platformName = 'postgresql'; + } elseif ($platform instanceof MySQLPlatform) { + $platformName = 'mysql'; + } else { + throw QueryException::syntaxError( + \sprintf( + 'Not supported platform "%s"', + $platform::class + ) + ); + } + $className = __NAMESPACE__ . '\\Platform\\Functions\\' . static::classify(\strtolower($platformName)) diff --git a/tests/config/mysql.phpunit.xml b/tests/config/mysql.phpunit.xml index 5ed9c527744..5840cd42481 100644 --- a/tests/config/mysql.phpunit.xml +++ b/tests/config/mysql.phpunit.xml @@ -2,11 +2,11 @@ - + - + diff --git a/tests/config/pgsql.phpunit.xml b/tests/config/pgsql.phpunit.xml index 2786537d39c..26f2b83d3d9 100644 --- a/tests/config/pgsql.phpunit.xml +++ b/tests/config/pgsql.phpunit.xml @@ -2,11 +2,11 @@ - + - +