Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Doctrine DBAL 4 and ORM 3 #494

Merged
merged 7 commits into from
Feb 19, 2024

Conversation

dmaicher
Copy link
Contributor

Subject

I am targeting this branch, because its BC.

Changelog

### Added
- compatibility with `doctrine/dbal` 4 and `doctrine/orm` 3

@dmaicher
Copy link
Contributor Author

dmaicher commented Nov 13, 2023

currently CI does not run any build with stability=dev dependencies. Shall I add that somehow on devkit? Not so familiar with that.

passes fine locally with dev dependencies and DBAL 4 + ORM 3

PHPUnit 9.6.13 by Sebastian Bergmann and contributors.

Testing 
.........................................                         41 / 41 (100%)

Time: 00:00.255, Memory: 30.00 MB

OK (41 tests, 76 assertions)

Remaining indirect deprecation notices (5)

  2x: Since symfony/framework-bundle 6.4: Not setting the "framework.handle_all_throwables" config option is deprecated. It will default to "true" in 7.0.
    2x in DoctrineORMMapperTest::testDoctrineMappingLoaded from Sonata\Doctrine\Tests\Mapper\ORM

  2x: Since symfony/framework-bundle 6.4: Not setting the "framework.php_errors.log" config option is deprecated. It will default to "true" in 7.0.
    2x in DoctrineORMMapperTest::testDoctrineMappingLoaded from Sonata\Doctrine\Tests\Mapper\ORM

  1x: Since symfony/framework-bundle 6.4: Enabling the integration of Doctrine annotations is deprecated. Set the "framework.annotations.enabled" config option to false.
    1x in DoctrineORMMapperTest::testDoctrineMappingLoaded from Sonata\Doctrine\Tests\Mapper\ORM

Other deprecation notices (2)

  1x: Since symfony/framework-bundle 6.4: The "annotations.cache_warmer" service is deprecated without replacement.
    1x in DoctrineORMMapperTest::testDoctrineMappingLoaded from Sonata\Doctrine\Tests\Mapper\ORM

  1x: Since symfony/framework-bundle 6.4: The "annotations.reader" service is deprecated without replacement.
    1x in DoctrineORMMapperTest::testDoctrineMappingLoaded from Sonata\Doctrine\Tests\Mapper\ORM

@dmaicher dmaicher requested a review from a team November 13, 2023 20:12
@@ -63,6 +63,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
$container->loadFromExtension('doctrine', [
'dbal' => ['url' => 'sqlite://:memory:'],
'orm' => [
'report_fields_where_declared' => true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed on ORM 3. Otherwise:

1) Sonata\Doctrine\Tests\Mapper\ORM\DoctrineORMMapperTest::testDoctrineMappingLoaded
InvalidArgumentException: The $reportFieldsWhereDeclared argument is no longer supported, make sure to omit it when calling Doctrine\ORM\Mapping\Driver\AttributeDriver::__construct.

/var/www/sonata-doctrine-extensions/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php:45
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/get_Doctrine_Orm_DefaultMetadataDriverService.php:21
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/Sonata_Doctrine_Tests_App_KernelTestDebugContainer.php:98
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/getDoctrine_Orm_DefaultConfigurationService.php:26
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/Sonata_Doctrine_Tests_App_KernelTestDebugContainer.php:98
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/getDoctrine_Orm_DefaultEntityManagerService.php:24
/tmp/sonata-doctrine-extensions/var/cache/ContainerKqO7EY2/getDoctrine_Orm_DefaultEntityManagerService.php:21
/var/www/sonata-doctrine-extensions/vendor/symfony/var-exporter/Internal/LazyObjectState.php:97
/var/www/sonata-doctrine-extensions/vendor/symfony/var-exporter/LazyGhostTrait.php:176
/var/www/sonata-doctrine-extensions/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:513
/var/www/sonata-doctrine-extensions/vendor/symfony/doctrine-bridge/CacheWarmer/ProxyCacheWarmer.php:48
/var/www/sonata-doctrine-extensions/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:108
/var/www/sonata-doctrine-extensions/vendor/symfony/http-kernel/Kernel.php:545
/var/www/sonata-doctrine-extensions/vendor/symfony/http-kernel/Kernel.php:763
/var/www/sonata-doctrine-extensions/vendor/symfony/http-kernel/Kernel.php:126
/var/www/sonata-doctrine-extensions/vendor/symfony/framework-bundle/Test/KernelTestCase.php:73
/var/www/sonata-doctrine-extensions/tests/Mapper/ORM/DoctrineORMMapperTest.php:58
/var/www/sonata-doctrine-extensions/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
/var/www/sonata-doctrine-extensions/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684
/var/www/sonata-doctrine-extensions/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684
/var/www/sonata-doctrine-extensions/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684
/var/www/sonata-doctrine-extensions/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651

@VincentLanglet
Copy link
Member

currently CI does not run any build with stability=dev dependencies. Shall I add that somehow on devkit? Not so familiar with that.

That could be an idea.

So far we used variant
https://github.com/sonata-project/dev-kit/blob/master/templates/project/.github/workflows/test.yaml.twig#L60
Not sure if we can add a variant with multiple lib.

Another idea would be to add a Ci with stability dev, maybe allowToFail: true for this build ?

@VincentLanglet
Copy link
Member

Hi, Any news about this PR @dmaicher ?

@dmaicher
Copy link
Contributor Author

@VincentLanglet the dev build works using DBAL 4 and ORM 3: https://github.com/sonata-project/sonata-doctrine-extensions/actions/runs/7626608873/job/20773373404?pr=494

Now just the question how to get this working with dev-kit 😄

@dmaicher dmaicher force-pushed the doctrine_dbal_orm branch 2 times, most recently from 6543c1b to dbe3dbd Compare January 23, 2024 13:52
@VincentLanglet
Copy link
Member

Now just the question how to get this working with dev-kit 😄

Do you need help with this ?

@dmaicher
Copy link
Contributor Author

Now just the question how to get this working with dev-kit 😄

Do you need help with this ?

Yeah I won't look into this anytime soon I think. If someone could help out that would be nice.

@dmaicher
Copy link
Contributor Author

dmaicher commented Feb 4, 2024

@VincentLanglet final versions for ORM and DBAL have been released - so no devkit changes needed for now.

But the static analysis fails seem interesting. Probably we are indeed not compatible with ORM 3 and its not covered by tests

@VincentLanglet
Copy link
Member

@VincentLanglet final versions for ORM and DBAL have been released - so no devkit changes needed for now.

But the static analysis fails seem interesting. Probably we are indeed not compatible with ORM 3 and its not covered by tests

Indeed, discriminator column is now a class
https://github.com/doctrine/orm/blob/3.0.x/src/Mapping/DiscriminatorColumnMapping.php

Maybe adding a toArray on the doctrine side would be helpful for library to support both ORM 2 and 3.
WDYT @dmaicher

cc @greg0ire

@VincentLanglet
Copy link
Member

VincentLanglet commented Feb 6, 2024

I opened doctrine/orm#11226 for the static analysis

And you can rebase for the rector build.

@VincentLanglet
Copy link
Member

I opened doctrine/orm#11226 for the static analysis

We can ignore the error until the PR is merged/released.

Do you have time to finish the PR @dmaicher ?

@dmaicher
Copy link
Contributor Author

I opened doctrine/orm#11226 for the static analysis

We can ignore the error until the PR is merged/released.

Do you have time to finish the PR @dmaicher ?

I will take a look later today 👍

@dmaicher dmaicher force-pushed the doctrine_dbal_orm branch 2 times, most recently from 7a7e42a to bece345 Compare February 19, 2024 18:42
@dmaicher dmaicher merged commit 65c4a93 into sonata-project:2.x Feb 19, 2024
14 checks passed
@dmaicher dmaicher deleted the doctrine_dbal_orm branch February 19, 2024 19:31
@VincentLanglet
Copy link
Member

2.4.0 is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants