for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection\Compiler;
use ApiPlatform\Core\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Injects mutations.
* @internal
* @author Raoul Clais <[email protected]>
final class MutationPass implements CompilerPassInterface
{
* {@inheritdoc}
* @throws RuntimeException
public function process(ContainerBuilder $container)
$mutations = [];
foreach ($container->findTaggedServiceIds('api_platform.graphql_mutation', true) as $serviceId => $tags) {
foreach ($tags as $tag) {
if (!isset($tag['id'])) {
$tag['id'] = $serviceId;
}
$mutations[$tag['id']] = new Reference($serviceId);
$container->getDefinition('api_platform.graphql.mutation_locator')->addArgument($mutations);