Cannot autowire argument $redis of "App\Controller\HomeController::saveComments()": such service exists
Всем добрый день! Пытаюсь подключить в контроллер Редис
class HomeController extends AbstractController
{
/**
* @Route("/page/{slug}", name="slug")
*/
public function page(string $slug, RedisInterface $redis) {
$userComments = $redis->getComment();
return $this->render("$slug.html.twig", ['comments' => $userComments]);
}
}
Создала в Сервисе два класса, один из которых интерфейс, другой - наследуемый от него класс
и подключила в контроллере, летит ошибка
Cannot autowire argument $redis of "App\Controller\HomeController::saveComments()": it references interface "App\Service\RedisInterface" but no such service exists. Did you create a class that implements this interface?
вот класс интерфейса
interface RedisInterface
{
function getComment();
function save(string $name, string $comments);
}
и реализуемый этот интерфейс класс
class Redis implements RedisInterface
{
private $redis;
private function __construct()
{
$this->redis = new Client();
}
function getComment()
{
$fields = $this->redis->hgetall('comments');
foreach ($fields as $field) {
yield unserialize($field);
}
}
function save(string $name, string $comments)
{
$serializedData = serialize(['name' => $name, 'comment' => $comments]);
$this->redis->incr('userCount');
$this->redis->hset('comments', $this->redis->get('userCount'), $serializedData);
}
}
совсем не понимаю, откуда эта ошибка - гугл мне не подсказывает, заранее благодарю за помощь