Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\ApiBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Mautic\ApiBundle\Serializer\Driver\ApiMetadataDriver;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class SerializerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* Replaces the available metadata drivers (yaml, xml, and annotation)
|
||||
* with our metadata driver, as we do not use any of those. There's
|
||||
* currently no other way that I can find to get our driver into the
|
||||
* chain in front of the rest.
|
||||
*/
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if ($container->hasDefinition('jms_serializer.metadata.doctrine_type_driver')) {
|
||||
$definition = $container->getDefinition('jms_serializer.metadata.doctrine_type_driver');
|
||||
$definition->replaceArgument(0, new Reference(ApiMetadataDriver::class));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\ApiBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
|
||||
class MauticApiExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* @param mixed[] $configs
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Config'));
|
||||
$loader->load('services.php');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user