Skip to content

Instantly share code, notes, and snippets.

@polidog
Created June 14, 2016 10:14
Show Gist options
  • Save polidog/22108eed742dd3082d7b9dc71942c6d1 to your computer and use it in GitHub Desktop.
Save polidog/22108eed742dd3082d7b9dc71942c6d1 to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use AppBundle\DependencyInjection\Compiler\YahooOAuthCompilerPass;
class AppBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new YahooOAuthCompilerPass());
}
}
<?php
namespace AppBundle\DependencyInjection\Compiler
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use AppBundle\OAuth\ResourceOwner\YahooJpResourceOwner;
/**
* OAuth2は基本使わないのでYahooように改造する
* Class YahooOAuthCompilerPass
*/
class YahooOAuthCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('hwi_oauth.resource_owner.yahoo');
$definition->setClass(YahooJpResourceOwner::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment