2020-03-15 21:21:11 +00:00
|
|
|
<?php
|
|
|
|
|
2020-08-03 22:08:47 +01:00
|
|
|
// {{{ License
|
|
|
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
|
|
|
//
|
|
|
|
// GNU social is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// GNU social is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// }}}
|
2020-03-21 20:18:05 +00:00
|
|
|
|
|
|
|
/**
|
2020-05-10 21:43:15 +01:00
|
|
|
* Compiler pass which triggers Symfony to tell Doctrine to
|
2020-03-21 20:18:05 +00:00
|
|
|
* use out `SchemaDef` metadata driver
|
|
|
|
*
|
|
|
|
* @package GNUsocial
|
|
|
|
* @category DB
|
|
|
|
*
|
|
|
|
* @author Hugo Sales <hugo@fc.up.pt>
|
|
|
|
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2020-03-15 21:21:11 +00:00
|
|
|
namespace App\DependencyInjection\Compiler;
|
|
|
|
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
|
|
|
|
/**
|
2020-08-03 22:08:47 +01:00
|
|
|
* Register a new ORM driver to allow use to use the old (and better) schemaDef format
|
2020-03-15 21:21:11 +00:00
|
|
|
*/
|
2020-03-19 15:53:09 +00:00
|
|
|
class SchemaDefPass implements CompilerPassInterface
|
2020-03-15 21:21:11 +00:00
|
|
|
{
|
|
|
|
public function process(ContainerBuilder $container)
|
|
|
|
{
|
|
|
|
$container->findDefinition('doctrine.orm.default_metadata_driver')
|
|
|
|
->addMethodCall('addDriver',
|
2020-05-11 19:15:08 +01:00
|
|
|
[new Reference('app.core.schemadef_driver'), 'App\\Entity']
|
2020-03-15 21:21:11 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|