Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions DependencyInjection/Compiler/AutowiringTypesPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the OverblogGraphQLBundle package.
*
* (c) Overblog <http://github.com/overblog/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Overblog\GraphQLBundle\DependencyInjection\Compiler;

use GraphQL\Executor\Promise\PromiseAdapter;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class AutowiringTypesPass implements CompilerPassInterface
{
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
$container->findDefinition('overblog_graphql.promise_adapter')->setAutowiringTypes([PromiseAdapter::class]);
}
}
2 changes: 0 additions & 2 deletions DependencyInjection/OverblogGraphQLExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Overblog\GraphQLBundle\DependencyInjection;

use GraphQL\Executor\Promise\PromiseAdapter;
use GraphQL\Schema;
use Overblog\GraphQLBundle\Config\TypeWithOutputFieldsDefinition;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -173,7 +172,6 @@ private function setServicesAliases(array $config, ContainerBuilder $container)
$container->setAlias($alias, $id);
// set autowiring types for promise adapter service
if ($this->getAlias().'.promise_adapter' === $alias) {
$container->findDefinition($id)->setAutowiringTypes([PromiseAdapter::class]);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions OverblogGraphQLBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Overblog\GraphQLBundle;

use Overblog\GraphQLBundle\DependencyInjection\Compiler\AutoMappingPass;
use Overblog\GraphQLBundle\DependencyInjection\Compiler\AutowiringTypesPass;
use Overblog\GraphQLBundle\DependencyInjection\Compiler\ConfigTypesPass;
use Overblog\GraphQLBundle\DependencyInjection\Compiler\MutationTaggedServiceMappingTaggedPass;
use Overblog\GraphQLBundle\DependencyInjection\Compiler\ResolverTaggedServiceMappingPass;
Expand All @@ -35,10 +36,11 @@ public function build(ContainerBuilder $container)
//ConfigTypesPass and AutoMappingPass must be before TypeTaggedServiceMappingPass
$container->addCompilerPass(new AutoMappingPass());
$container->addCompilerPass(new ConfigTypesPass());
$container->addCompilerPass(new AutowiringTypesPass());

$container->addCompilerPass(new TypeTaggedServiceMappingPass(), PassConfig::TYPE_OPTIMIZE);
$container->addCompilerPass(new ResolverTaggedServiceMappingPass(), PassConfig::TYPE_OPTIMIZE);
$container->addCompilerPass(new MutationTaggedServiceMappingTaggedPass(), PassConfig::TYPE_OPTIMIZE);
$container->addCompilerPass(new TypeTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
$container->addCompilerPass(new ResolverTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
$container->addCompilerPass(new MutationTaggedServiceMappingTaggedPass(), PassConfig::TYPE_BEFORE_REMOVING);

$container->registerExtension(new OverblogGraphQLTypesExtension());
}
Expand Down