Skip to content

Instantly share code, notes, and snippets.

@fritz-gerneth
Created December 21, 2016 08:43
Show Gist options
  • Save fritz-gerneth/47bc5a2a84a4c3099720222617d475fa to your computer and use it in GitHub Desktop.
Save fritz-gerneth/47bc5a2a84a4c3099720222617d475fa to your computer and use it in GitHub Desktop.
<?php
class ProcessorFactory
{
public function __invoke(ContainerInterface $container)
{
$processor = new Processor(
$container->get(Schema::class)
);
$processor->getExecutionContext()->getContainer()->set(
ContainerInterface::class,
$container
);
return $processor;
}
}
<?php
trait ServiceLocatorAwareTrait
{
/**
* @param ResolveInfo $info
* @return ContainerInterface
*/
protected function getServiceLocator(ResolveInfo $info)
{
return $info->getContainer()->get(ContainerInterface::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment