diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 129ae31..233731b 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -16,22 +16,17 @@ jobs: php: - '8.3' steps: - - uses: actions/checkout@v6 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: 'pdo_sqlite, gd' - tools: cs2pr + - uses: actions/checkout@v6 - - uses: ramsey/composer-install@v3 - with: - dependency-versions: "highest" + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - - name: Run code style check - run: composer run-script check-cs -- --format=checkstyle | cs2pr + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr tests: name: Tests @@ -45,31 +40,29 @@ jobs: - '7.4' - '8.3' - '8.4' + doctrine-persistence: + - 'doctrine/persistence:^2.0' + - 'doctrine/persistence:^3.0' steps: - - uses: actions/checkout@v6 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_sqlite, gd - tools: cs2pr + - uses: actions/checkout@v6 - - uses: ramsey/composer-install@v3 - with: - dependency-versions: "highest" - composer-options: "${{ matrix.composer_options }}" + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} + composer-options: "--with ${{ matrix.doctrine-persistence }}" - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Run PHPStan analysis - run: composer run-script phpstan + - name: Run PHPStan analysis + run: composer run-script phpstan - - name: Run test suite - run: composer run-script --timeout=600 test + - name: Run test suite + run: composer run-script --timeout=600 test integration-tests-postgres: name: PostgreSQL integration tests @@ -97,21 +90,21 @@ jobs: - '7.4' - '8.3' - '8.4' + doctrine-persistence: + - 'doctrine/persistence:^2.0' + - 'doctrine/persistence:^3.0' steps: - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_pgsql, gd - tools: cs2pr - - - uses: ramsey/composer-install@v3 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} + composer-options: "--with ${{ matrix.doctrine-persistence }}" + php-extensions: 'pdo_pgsql, gd' - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -159,21 +152,21 @@ jobs: - '7.4' - '8.3' - '8.4' + doctrine-persistence: + - 'doctrine/persistence:^2.0' + - 'doctrine/persistence:^3.0' steps: - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_pgsql, gd - tools: cs2pr - - - uses: ramsey/composer-install@v3 - with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} + composer-options: "--with ${{ matrix.doctrine-persistence }}" + php-extensions: 'pdo_mysql, gd' - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -217,21 +210,21 @@ jobs: - '7.4' - '8.3' - '8.4' + doctrine-persistence: + - 'doctrine/persistence:^2.0' + - 'doctrine/persistence:^3.0' steps: - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_mysql, gd - tools: cs2pr - - - uses: ramsey/composer-install@v3 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} + composer-options: "--with ${{ matrix.doctrine-persistence }}" + php-extensions: 'pdo_mysql, gd' - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" diff --git a/composer.json b/composer.json index b2a1999..eb4d7be 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "require": { "php": "^7.4 || ^8.0", - "doctrine/persistence": "^3", + "doctrine/persistence": "^2 || ^3", "ibexa/core": "~4.6.x-dev", "ibexa/core-persistence": "~4.6.x-dev", "ibexa/polyfill-php82": "^1.0", diff --git a/src/bundle/Transport/ConnectionRegistry.php b/src/bundle/Transport/ConnectionRegistry.php index d4982cb..f390a9d 100644 --- a/src/bundle/Transport/ConnectionRegistry.php +++ b/src/bundle/Transport/ConnectionRegistry.php @@ -32,7 +32,12 @@ public function getDefaultConnectionName(): string return $this->registry->getDefaultConnectionName(); } - public function getConnection(?string $name = null): object + /** + * Cannot declare types to maintain compatibility with doctrine/persistence v2. + * + * @param string|null $name + */ + public function getConnection($name = null): object { if ($name === self::DEFAULT_IBEXA_CONNECTION) { $name = $this->repositoryConfigurationProvider->getStorageConnectionName();