From 144d28fac3a110a5af771c6665dfe3b1c5c2cf73 Mon Sep 17 00:00:00 2001 From: Thomas Beaujean Date: Mon, 27 May 2024 16:43:15 +0200 Subject: [PATCH] Add doctrine\orm 3 --- .github/workflows/php.yml | 2 +- composer.json | 4 ++-- src/Generator/RepositoryGenerator.php | 1 + src/Generator/TemplateService.php | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ec15ec8..8df328a 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,7 +12,7 @@ jobs: matrix: operating-system: [ ubuntu-latest ] php: [ '8.1','8.2'] - symfony: ['5.4.*', '6.0.*', '6.1.*', '6.2.*', '6.3.*', '7.0.*'] + symfony: ['5.4.*', '6.3.*', '7.0.*'] exclude: - php: '8.1' symfony: '7.0.*' diff --git a/composer.json b/composer.json index 4f57136..ec0f845 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ "php": "^8.1", "symfony/maker-bundle": "^1.7", "symfony/framework-bundle": "^5.4|^6.0|^7.0", - "doctrine/doctrine-bundle": "^2.10", + "doctrine/doctrine-bundle": "^2.12", "symfony/twig-bundle": "^5.4|^6.0|^7.0", - "doctrine/orm": "^2.10" + "doctrine/orm": "^3.0" } } diff --git a/src/Generator/RepositoryGenerator.php b/src/Generator/RepositoryGenerator.php index cb18f6b..4cc1c99 100644 --- a/src/Generator/RepositoryGenerator.php +++ b/src/Generator/RepositoryGenerator.php @@ -91,6 +91,7 @@ private function generateRepository(array $allMetadata, string $bundleName, Clas ); } + /** @var \Doctrine\ORM\Mapping\OneToManyAssociationMapping */ foreach ($associationMappings as $associationMapping) { $targetEntityMetadata = $allMetadata[$associationMapping['targetEntity']]; diff --git a/src/Generator/TemplateService.php b/src/Generator/TemplateService.php index 1d866b4..e55a914 100644 --- a/src/Generator/TemplateService.php +++ b/src/Generator/TemplateService.php @@ -3,6 +3,7 @@ namespace Tbn\QueryBuilderRepositoryGeneratorBundle\Generator; use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Mapping\OneToManyAssociationMapping; use Tbn\QueryBuilderRepositoryGeneratorBundle\Configuration\Configurator; use Twig\Environment; @@ -33,7 +34,7 @@ public function renderTopClass(string $extendClass, string $namespace, string $e } public function renderAssociation( - array $associationMapping, + OneToManyAssociationMapping $associationMapping, string $entityDql, ClassMetadata $targetEntityMetadata, string $entityDqlTargeted,