[DOCTRINE][SCHEMADEF] Create a new metadata driver to allow us to continue using static schemaDef functions

This has the benefit of requiring fewer code changes, as well as providing a better isolation
between GNU social and symfony, useful in case the framework needs to be changed
This commit is contained in:
Hugo Sales
2020-03-15 21:21:11 +00:00
committed by Hugo Sales
parent 710aa946ab
commit cc72373e3d
24 changed files with 835 additions and 148 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Register a new ORM driver to allow use to use the old schemaDef format
*/
class SchemaDefCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$container->findDefinition('doctrine.orm.default_metadata_driver')
->addMethodCall('addDriver',
[new Reference('app.util.schemadef_driver'), 'App\\Entity']
);
$container->setParameter('doctrine.orm.metadata.schemadef.class', App\Util\SchemaDefDriver::class);
}
}