From d2da5950f042b443bbd0bfd89213900bfc926ba5 Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Thu, 3 Aug 2023 10:16:33 +0200 Subject: [PATCH] doctrine annotations (#13) * change TestCase --- Tests/TestCase.php | 19 ++++++++++--------- UPGRADE-9.0.md | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Tests/TestCase.php b/Tests/TestCase.php index 64e5741..e6f1d07 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -15,14 +15,14 @@ use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\DocParser; -use Doctrine\Common\Cache\Psr6\DoctrineProvider; +use Doctrine\DBAL\DriverManager; use Doctrine\ODM\MongoDB\Configuration; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Mapping\ClassMetadataFactory; -use Doctrine\ORM\Tools\Setup; +use Doctrine\ORM\ORMSetup; use Spiriit\Bundle\FormFilterBundle\DependencyInjection\Compiler\FormDataExtractorPass; use Spiriit\Bundle\FormFilterBundle\DependencyInjection\SpiriitFormFilterExtension; use Spiriit\Bundle\FormFilterBundle\Filter\Form\FilterExtension; @@ -79,28 +79,29 @@ public function getFormFactory() public function getSqliteEntityManager() { $arrayAdapter = new ArrayAdapter(); - $cache = DoctrineProvider::wrap(new ArrayAdapter()); + $cache = new ArrayAdapter(); $reader = new AnnotationReader(new DocParser()); $mappingDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, [__DIR__ . '/Fixtures/Entity']); - $config = Setup::createAnnotationMetadataConfiguration([]); + $config = ORMSetup::createAnnotationMetadataConfiguration([]); $config->setMetadataDriverImpl($mappingDriver); $config->setMetadataCache($arrayAdapter); - $config->setQueryCacheImpl($cache); + $config->setQueryCache($cache); $config->setProxyDir(sys_get_temp_dir()); $config->setProxyNamespace('Proxy'); $config->setAutoGenerateProxyClasses(true); $config->setClassMetadataFactoryName(ClassMetadataFactory::class); $config->setDefaultRepositoryClassName(EntityRepository::class); - $conn = ['driver' => 'pdo_sqlite', 'memory' => true]; + $connection = DriverManager::getConnection([ + 'driver' => 'pdo_sqlite', + 'memory' => true + ], $config); - $em = EntityManager::create($conn, $config); - - return $em; + return new EntityManager($connection, $config); } public function getMongodbDocumentManager(): DocumentManager diff --git a/UPGRADE-9.0.md b/UPGRADE-9.0.md index a4d7607..cf21647 100644 --- a/UPGRADE-9.0.md +++ b/UPGRADE-9.0.md @@ -52,3 +52,4 @@ after ```php spiriit_form_filter ``` +