Skip to content

Commit e1dae8b

Browse files
authored
Merge pull request #5 from phpcr/odm3
allow installation with phpcr-odm 3
2 parents 321955f + 7cef0e2 commit e1dae8b

File tree

14 files changed

+72
-40
lines changed

14 files changed

+72
-40
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
include:
23-
- php-version: '8.1'
24-
symfony-version: '^5.4'
25-
26-
- php-version: '8.1'
27-
symfony-version: '6.0.*'
28-
2923
- php-version: '8.1'
3024
symfony-version: '^6.0'
3125

@@ -42,16 +36,15 @@ jobs:
4236
with:
4337
php-version: ${{ matrix.php-version }}
4438
extensions: ctype, iconv, mysql
39+
tools: composer:v2, flex
4540
ini-values: memory_limit=-1
4641
coverage: none
4742

48-
- name: Add additional packages
43+
- name: Composer update
44+
env:
45+
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
4946
run: |
50-
composer require symfony/symfony:${{ matrix.symfony-version }} --no-update
51-
if: ${{ matrix.symfony-version }}
52-
53-
- name: Install composer dependencies
54-
uses: ramsey/composer-install@v3
47+
composer update ${{ matrix.composer-flag }} --prefer-dist --no-interaction --no-progress
5548
5649
- name: Prepare phpcr odm doctrine dbal
5750
run: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh

.php-cs-fixer.dist.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
$finder = PhpCsFixer\Finder::create()
44
->in('src/')
5-
->in('tests/');
5+
->in('tests/')
6+
->exclude(__DIR__.'/tests/Resources/App/var')
7+
;
68
$config = new PhpCsFixer\Config();
79

810
return $config->setFinder($finder)

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
2.0.0
5+
-----
6+
7+
* Replace ContainerAwareInterface from Symfony with `PHPCR\PhpcrMigrationsBundle\ContainerAwareInterface`.
8+
While 1.5.0 can be installed with Symfony 7, the container aware mechanism stopped working.
9+
* Allow installation with PHPCR-ODM 3.0.
10+
* Drop support for Symfony 5.
11+
412
1.5.0
513
-----
614

composer.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,26 @@
1616
"php": "^8.1",
1717
"phpcr/phpcr-migrations": "^1.1",
1818
"phpcr/phpcr-implementation": "^2.1",
19-
"doctrine/phpcr-bundle": "^1.3 || ^2.0",
20-
"symfony/config": "^5.4 || ^6.0 || ^7.0",
21-
"symfony/console": "^5.4 || ^6.0 || ^7.0",
22-
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
23-
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
19+
"doctrine/phpcr-bundle": "^1.3 || ^2.0 || ^3.0",
20+
"symfony/config": "^6.0 || ^7.0",
21+
"symfony/console": "^6.0 || ^7.0",
22+
"symfony/dependency-injection": "^6.0 || ^7.0",
23+
"symfony/http-kernel": "^6.0 || ^7.0"
2424
},
2525
"require-dev": {
2626
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
2727
"doctrine/phpcr-odm": "^1.4 || ^2.0",
28+
"jackalope/jackalope-doctrine-dbal": "^2.0",
2829
"symfony/monolog-bundle": "^3.0",
2930
"symfony/phpunit-bridge": "^7.0",
30-
"symfony/symfony": "^5.4 || ^6.0 || ^7.0",
31-
"symfony-cmf/testing": "^2.1 || ^3.0 || ^4.0"
31+
"symfony-cmf/testing": "^5.0",
32+
"symfony/security-bundle": "^6.0 || ^7.0",
33+
"symfony/twig-bundle": "^6.0 || ^7.0",
34+
"symfony/yaml": "^6.0 || ^7.0",
35+
"symfony/translation": "^6.0 || ^7.0",
36+
"symfony/form": "^6.0 || ^7.0",
37+
"symfony/validator": "^6.0 || ^7.0",
38+
"symfony/property-access": "^6.0 || ^7.0"
3239
},
3340
"autoload": {
3441
"psr-4": {

src/Command/MigrateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
namespace PHPCR\PhpcrMigrationsBundle\Command;
1313

1414
use PHPCR\Migrations\MigratorFactory;
15+
use PHPCR\PhpcrMigrationsBundle\ContainerAwareInterface;
1516
use Symfony\Component\Console\Command\Command;
1617
use Symfony\Component\Console\Input\InputArgument;
1718
use Symfony\Component\Console\Input\InputInterface;
1819
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2020
use Symfony\Component\DependencyInjection\ContainerInterface;
2121

2222
class MigrateCommand extends Command

src/ContainerAwareInterface.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the PHPCR Migrations package
5+
*
6+
* (c) Daniel Leech <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace PHPCR\PhpcrMigrationsBundle;
13+
14+
use Symfony\Component\DependencyInjection\ContainerInterface;
15+
16+
/**
17+
* Interface for migrations to get the Symfony container injected.
18+
*/
19+
interface ContainerAwareInterface
20+
{
21+
public function setContainer(?ContainerInterface $container = null): void;
22+
}

tests/Functional/MigrateCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class MigrateCommandTest extends BaseTestCase
1515
{
1616
/**
17-
* It should migrate all the unexecuted migrators.
17+
* It should migrate all the non-executed migrators.
1818
*/
1919
public function testMigrateToLatest(): void
2020
{

tests/Resources/App/AppKernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class AppKernel extends TestKernel
2222
{
23-
public function configure()
23+
public function configure(): void
2424
{
2525
$this->requireBundleSets([
2626
'default',
@@ -34,14 +34,14 @@ public function configure()
3434
]);
3535
}
3636

37-
public function registerContainerConfiguration(LoaderInterface $loader)
37+
public function registerContainerConfiguration(LoaderInterface $loader): void
3838
{
3939
$loader->import(CMF_TEST_CONFIG_DIR.'/default.php');
4040
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
4141
$loader->load(__DIR__.'/config/config.yml');
4242
}
4343

44-
protected function prepareContainer(ContainerBuilder $container)
44+
protected function prepareContainer(ContainerBuilder $container): void
4545
{
4646
parent::prepareContainer($container);
4747
$container->setParameter('cmf_testing.bundle_fqn', 'Phpcr\PhpcrMigrationsBundle\PhpcrMigrationsBundle');

tests/Resources/App/config/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ phpcr_migrations:
22
version_node_name: "jcr:migrations"
33

44
framework:
5-
annotations: true
5+
property_access: ~

tests/Resources/Bundle/OneTestBundle/Resources/phpcr-migrations/Version201501011200.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
class Version201501011200 implements VersionInterface
1616
{
17-
public function up(SessionInterface $session)
17+
public function up(SessionInterface $session): void
1818
{
1919
$session->getRootNode()->addNode('hello');
2020
}
2121

22-
public function down(SessionInterface $session)
22+
public function down(SessionInterface $session): void
2323
{
2424
$session->getRootNode()->getNode('hello')->remove();
2525
}

0 commit comments

Comments
 (0)