Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.x' into 1-to-2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 5, 2024
2 parents e1dae8b + d59c4a9 commit 09ab432
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 20 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ on:

jobs:
php:
name: "PHP ${{ matrix.php-version }} Symfony ${{ matrix.symfony-version }}"
name: "PHP ${{ matrix.php-version }} Symfony ${{ matrix.symfony-version }} ${{ matrix.dependencies}}"
runs-on: ubuntu-latest

env:
KERNEL_CLASS: PHPCR\PhpcrMigrationsBundle\Tests\Resources\App\AppKernel
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}

strategy:
fail-fast: false
matrix:
include:
- php-version: '8.1'
symfony-version: '^6.0'
dependencies: 'lowest'

- php-version: '8.1'
symfony-version: '^6.4'

- php-version: '8.2'

Expand All @@ -40,11 +45,11 @@ jobs:
ini-values: memory_limit=-1
coverage: none

- name: Composer update
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
run: |
composer update ${{ matrix.composer-flag }} --prefer-dist --no-interaction --no-progress
- name: Install dependencies with Composer
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Prepare phpcr odm doctrine dbal
run: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$finder = PhpCsFixer\Finder::create()
->in('src/')
->in('tests/')
->exclude(__DIR__.'/tests/Resources/App/var')
->exclude('tests/Resources/App/var/')
;
$config = new PhpCsFixer\Config();

Expand Down
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ CHANGELOG
2.0.0
-----

* Replace ContainerAwareInterface from Symfony with `PHPCR\PhpcrMigrationsBundle\ContainerAwareInterface`.
While 1.5.0 can be installed with Symfony 7, the container aware mechanism stopped working.
* Allow installation with PHPCR-ODM 3.0.
* Drop support for Symfony 5.

1.x
===

1.6.0
-----

* Deprecate using `Symfony\Component\DependencyInjection\ContainerAwareInterface` in favor of
`PHPCR\PhpcrMigrationsBundle\ContainerAwareInterface` as Symfony 7 dropped its
ContainerAwareInterface.
On Symfony 6, the legacy ContainerAwareInterface continues to be supported.

1.5.0
-----

* Allow installation with Symfony 7
* Allow installation with Symfony 7 (! broken if you use `Symfony\Component\DependencyInjection\ContainerAwareInterface`)
* Drop support for PHP < 8.1 and modernize code

1.4.0
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"php": "^8.1",
"phpcr/phpcr-migrations": "^1.1",
"phpcr/phpcr-implementation": "^2.1",
"doctrine/phpcr-bundle": "^1.3 || ^2.0 || ^3.0",
"doctrine/phpcr-bundle": "^2.2 || ^3.0",
"symfony/config": "^6.0 || ^7.0",
"symfony/console": "^6.0 || ^7.0",
"symfony/dependency-injection": "^6.0 || ^7.0",
"symfony/http-kernel": "^6.0 || ^7.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
"doctrine/doctrine-bundle": "^1.8 || ^2.5",
"doctrine/phpcr-odm": "^1.4 || ^2.0",
"jackalope/jackalope-doctrine-dbal": "^2.0",
"symfony/monolog-bundle": "^3.0",
"symfony/phpunit-bridge": "^7.0",
"symfony/phpunit-bridge": "^7.0.6",
"symfony-cmf/testing": "^5.0",
"symfony/security-bundle": "^6.0 || ^7.0",
"symfony/twig-bundle": "^6.0 || ^7.0",
Expand Down
4 changes: 4 additions & 0 deletions src/Command/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface as SymfonyContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class MigrateCommand extends Command
Expand Down Expand Up @@ -77,6 +78,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
foreach ($migrator->getVersions() as $version) {
if ($version instanceof ContainerAwareInterface) {
$version->setContainer($this->container);
} elseif ($version instanceof SymfonyContainerAwareInterface) {
$version->setContainer($this->container);
@trigger_error('Relying on '.SymfonyContainerAwareInterface::class.' is deprecated and will break when upgrading to Symfony 7. Use '.ContainerAwareInterface::class.' instead.', \E_USER_DEPRECATED);
}
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@

namespace PHPCR\PhpcrMigrationsBundle\Tests\Functional;

use PHPCR\SessionInterface;
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as CmfBaseTestCase;
use Symfony\Component\Console\Tester\CommandTester;

abstract class BaseTestCase extends CmfBaseTestCase
{
protected SessionInterface $session;

public function setUp(): void
{
$this->db('PHPCR')->purgeRepository();
Expand Down
2 changes: 1 addition & 1 deletion tests/Resources/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->import(CMF_TEST_CONFIG_DIR.'/default.php');
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
$loader->load(__DIR__.'/config/config.yml');
$loader->load(__DIR__.'/config/config.php');
}

protected function prepareContainer(ContainerBuilder $container): void
Expand Down
15 changes: 15 additions & 0 deletions tests/Resources/App/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$frameworkConfig = [
'property_access' => true,
];

if (class_exists(Symfony\Component\Validator\Mapping\Loader\AnnotationLoader::class)) {
// Symfony < 7
$frameworkConfig['annotations'] = true;
}

$container->loadFromExtension('framework', $frameworkConfig);
$container->loadFromExtension('phpcr_migrations', [
'version_node_name' => 'jcr:migrations',
]);
5 changes: 0 additions & 5 deletions tests/Resources/App/config/config.yml

This file was deleted.

0 comments on commit 09ab432

Please sign in to comment.