Skip to content

Commit

Permalink
doctrine annotations (#13)
Browse files Browse the repository at this point in the history
* change TestCase
  • Loading branch information
gilles-g authored Aug 3, 2023
1 parent 65a9634 commit d2da595
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions UPGRADE-9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ after
```php
spiriit_form_filter
```

0 comments on commit d2da595

Please sign in to comment.