Search code examples
phpsymfonysymfony-3.4

Symfony2.8 upgraded to symfony3.4, Logger has an error


use Psr\Log\LoggerInterface;

class TestController extends Controller
{
    public function indexAction(Request $request, LoggerInterface $logger)
    {
        $logger->info('this is a Logger info!');
        return new Response('123456');
    }
}

requires that you provide a value for the "$logger" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. in /home/Workspaces/rlife_api/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php:78

Ask how to solve this problem???


Solution

  • There's a solution and is to tag the cotnrollers and enable the autowire in order to pass the deps in the right way