diff --git a/.doctrine-project.json b/.doctrine-project.json index 95075e8c..5d9ea176 100644 --- a/.doctrine-project.json +++ b/.doctrine-project.json @@ -4,16 +4,22 @@ "slug": "doctrine-bundle", "versions": [ { - "name": "2.13", - "branchName": "2.13.x", + "name": "2.14", + "branchName": "2.14.x", "slug": "latest", "upcoming": true }, + { + "name": "2.13", + "branchName": "2.13.x", + "slug": "2.13", + "current": true + }, { "name": "2.12", "branchName": "2.12.x", "slug": "2.12", - "current": true + "maintained": false }, { "name": "2.11", diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5c640bca..fcedea1f 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,6 +12,6 @@ on: jobs: coding-standards: name: "Coding Standards" - uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.1.0" with: composer-options: "--prefer-dist --prefer-stable" diff --git a/.github/workflows/composer-lint.yml b/.github/workflows/composer-lint.yml index aff94ca5..ce49a02a 100644 --- a/.github/workflows/composer-lint.yml +++ b/.github/workflows/composer-lint.yml @@ -15,4 +15,4 @@ on: jobs: composer-lint: name: "Composer Lint" - uses: "doctrine/.github/.github/workflows/composer-lint.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/composer-lint.yml@5.1.0" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 900daa2c..ec83c7c8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -12,7 +12,7 @@ on: jobs: phpunit: name: "PHPUnit" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-latest" env: SYMFONY_REQUIRE: ${{matrix.symfony-require}} SYMFONY_DEPRECATIONS_HELPER: weak @@ -110,7 +110,7 @@ jobs: upload_coverage: name: "Upload coverage to Codecov" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-latest" needs: - "phpunit" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..0518880f --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,20 @@ +name: "Documentation" + +on: + pull_request: + branches: + - "*.x" + paths: + - ".github/workflows/documentation.yml" + - "docs/**" + push: + branches: + - "*.x" + paths: + - ".github/workflows/documentation.yml" + - "docs/**" + +jobs: + documentation: + name: "Documentation" + uses: "doctrine/.github/.github/workflows/documentation.yml@5.1.0" \ No newline at end of file diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 3cac620a..e193d87b 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -8,7 +8,7 @@ on: jobs: release: name: "Git tag, release & create merge-up PR" - uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.1.0" secrets: GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4020dd09..fde93c2f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -12,7 +12,7 @@ on: jobs: static-analysis-psalm: name: "Static Analysis with Psalm" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-latest" steps: - name: "Checkout code" diff --git a/.github/workflows/test-dev-stability.yml b/.github/workflows/test-dev-stability.yml index 637dd5ad..89a7e73d 100644 --- a/.github/workflows/test-dev-stability.yml +++ b/.github/workflows/test-dev-stability.yml @@ -8,7 +8,7 @@ on: jobs: phpunit: name: "PHPUnit" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-latest" env: SYMFONY_REQUIRE: ${{matrix.symfony-require}} diff --git a/.symfony.bundle.yaml b/.symfony.bundle.yaml index 317d3800..ce14ec85 100644 --- a/.symfony.bundle.yaml +++ b/.symfony.bundle.yaml @@ -11,6 +11,6 @@ branches: maintained_branches: - "2.12.x" - "2.13.x" -doc_dir: "docs/" +doc_dir: { "2.12.x": "docs/", "2.13.x": "docs/en/" } current_branch: "2.12.x" dev_branch: "2.13.x" diff --git a/config/schema/doctrine-1.0.xsd b/config/schema/doctrine-1.0.xsd index 8e0a2bea..9f36708f 100644 --- a/config/schema/doctrine-1.0.xsd +++ b/config/schema/doctrine-1.0.xsd @@ -227,6 +227,7 @@ + diff --git a/docs/configuration.rst b/docs/en/configuration.rst similarity index 99% rename from docs/configuration.rst rename to docs/en/configuration.rst index dc60769e..bb2fdcc5 100644 --- a/docs/configuration.rst +++ b/docs/en/configuration.rst @@ -349,6 +349,7 @@ Configuration Reference - Acme\AppBundle\Entity\Order - Acme\AppBundle\Entity\PhoneNumber + fetch_mode_subselect_batch_size: 2000 # Search for the "ResolveTargetEntityListener" class for a cookbook about this resolve_target_entities: diff --git a/docs/custom-id-generators.rst b/docs/en/custom-id-generators.rst similarity index 100% rename from docs/custom-id-generators.rst rename to docs/en/custom-id-generators.rst diff --git a/docs/entity-listeners.rst b/docs/en/entity-listeners.rst similarity index 100% rename from docs/entity-listeners.rst rename to docs/en/entity-listeners.rst diff --git a/docs/event-listeners.rst b/docs/en/event-listeners.rst similarity index 100% rename from docs/event-listeners.rst rename to docs/en/event-listeners.rst diff --git a/docs/index.rst b/docs/en/index.rst similarity index 100% rename from docs/index.rst rename to docs/en/index.rst diff --git a/docs/installation.rst b/docs/en/installation.rst similarity index 100% rename from docs/installation.rst rename to docs/en/installation.rst diff --git a/docs/middlewares.rst b/docs/en/middlewares.rst similarity index 100% rename from docs/middlewares.rst rename to docs/en/middlewares.rst diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 06cf3dbd..04a38b27 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -663,6 +663,7 @@ private function getOrmEntityManagersNode(): ArrayNodeDefinition ->scalarNode('quote_strategy')->defaultValue('doctrine.orm.quote_strategy.default')->end() ->scalarNode('typed_field_mapper')->defaultValue('doctrine.orm.typed_field_mapper.default')->end() ->scalarNode('entity_listener_resolver')->defaultNull()->end() + ->scalarNode('fetch_mode_subselect_batch_size')->end() ->scalarNode('repository_factory')->defaultValue('doctrine.orm.container_repository_factory')->end() ->arrayNode('schema_ignore_classes') ->prototype('scalar')->end() diff --git a/src/DependencyInjection/DoctrineExtension.php b/src/DependencyInjection/DoctrineExtension.php index 30cbfa6f..f96249dc 100644 --- a/src/DependencyInjection/DoctrineExtension.php +++ b/src/DependencyInjection/DoctrineExtension.php @@ -722,6 +722,10 @@ protected function loadOrmEntityManager(array $entityManager, ContainerBuilder $ 'setIdentityGenerationPreferences' => $entityManager['identity_generation_preferences'], ]; + if (isset($entityManager['fetch_mode_subselect_batch_size'])) { + $methods['setEagerFetchBatchSize'] = $entityManager['fetch_mode_subselect_batch_size']; + } + if (! method_exists(OrmConfiguration::class, 'setLazyGhostObjectEnabled')) { unset($methods['setLazyGhostObjectEnabled']); } diff --git a/src/Twig/DoctrineExtension.php b/src/Twig/DoctrineExtension.php index 7c5f7539..adfcc065 100644 --- a/src/Twig/DoctrineExtension.php +++ b/src/Twig/DoctrineExtension.php @@ -6,12 +6,15 @@ use Doctrine\SqlFormatter\NullHighlighter; use Doctrine\SqlFormatter\SqlFormatter; use Symfony\Component\VarDumper\Cloner\Data; +use Twig\DeprecatedCallableInfo; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use function addslashes; use function array_key_exists; +use function array_merge; use function bin2hex; +use function class_exists; use function implode; use function is_array; use function is_bool; @@ -41,12 +44,20 @@ class DoctrineExtension extends AbstractExtension */ public function getFilters() { - return [ - new TwigFilter('doctrine_pretty_query', [$this, 'formatQuery'], ['is_safe' => ['html'], 'deprecated' => true]), + $out = [ new TwigFilter('doctrine_prettify_sql', [$this, 'prettifySql'], ['is_safe' => ['html']]), new TwigFilter('doctrine_format_sql', [$this, 'formatSql'], ['is_safe' => ['html']]), new TwigFilter('doctrine_replace_query_parameters', [$this, 'replaceQueryParameters']), ]; + $options = ['deprecated' => true]; + // exists since twig/twig 3.15 + if (class_exists(DeprecatedCallableInfo::class)) { + $options = ['deprecation_info' => new DeprecatedCallableInfo('doctrine/doctrine-bundle', '2.1')]; + } + + return array_merge($out, [ + new TwigFilter('doctrine_pretty_query', [$this, 'formatQuery'], ['is_safe' => ['html']] + $options), + ]); } /** diff --git a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php index 4c91dc2f..3033b839 100644 --- a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -1053,6 +1053,19 @@ public function testSchemaIgnoreClasses(): void $this->assertDICDefinitionMethodCallOnce($def1, 'setSchemaIgnoreClasses', [0 => ['Class\A', 'Class\B']]); } + public function testFetchModeSubselectBatchSize(): void + { + if (! interface_exists(EntityManagerInterface::class)) { + self::markTestSkipped('This test requires ORM'); + } + + $container = $this->loadContainer('orm_fetch_mode_subselect_batch_size'); + + $def1 = $container->getDefinition('doctrine.orm.default_configuration'); + + $this->assertDICDefinitionMethodCallOnce($def1, 'setEagerFetchBatchSize', [10000]); + } + public function testAttachEntityListeners(): void { if (! interface_exists(EntityManagerInterface::class)) { diff --git a/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml b/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml new file mode 100644 index 00000000..0cb1ed8a --- /dev/null +++ b/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml b/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml new file mode 100644 index 00000000..0c195e5f --- /dev/null +++ b/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml @@ -0,0 +1,6 @@ +doctrine: + dbal: + default_connection: default + + orm: + fetch_mode_subselect_batch_size: 10000