这是错误消息:传递给 App\Controller\PublisherController::index() 的参数 1 必须是 Symfony\Component\Mercure\Publisher 的实例,给出 Symfony\Component\Mercure\Debug\TraceablePublisher 的实例,在 /home 中调用/gw01/Etna/PLI/vendor/symfony/http-kernel/HttpKernel.php 在第 145 行(500 内部服务器错误)
发布者控制器:
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mercure\Publisher;
use Symfony\Component\Mercure\Update;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class PublisherController
* @package App\Controller
*/
class PublisherController extends AbstractController
{
/**
* @Route("/publish/{topic}", name="publisher", methods={"POST"})
*/
public function index(Publisher $publisher, $topic, Request $request)
{
$publisher(new Update($topic, $request->getContent()));
return new Response('success');
}
}
我该如何解决这个问题?