I want to override the controller (RegistartionController) of FosUserbundle by the using of compilerPass in Symfony 3.4 so this is my code
=== RegisterUserCompilerPass ===
<?php
namespace myBundle;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class RegisterUserCompilerPass extends CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$container
->getDefinition('fos_user.registration.controller')
->setClass(MyBundle\Controller\ReplaceRegistrationController::class) ;
}
}
and this is file when add add it to the main bundle class
<?php
namespace MyBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use MyBundle\DependencyInjection\Compiler\RegisterUserCompilerPass ;
// use Crypto\UserBundle\Manager\ReplaceRegistration ;
class CryptoUserBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new RegisterUserCompilerPass() );
}
}
when access to my register path i get
Compile Error: Class MyBundle\DependencyInjection\Compiler\RegisterUserCompilerPass cannot extend from interface Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
class RegisterUserCompilerPass extends CompilerPassInterface
should be
class RegisterUserCompilerPass implements CompilerPassInterface