我是自动接线的新手,目前正在使用PHP-DI。
我有以下控制器:
<?php
namespace Registration\Actions;
class Home
{
protected $responder;
public function __construct(\Registration\Responders\Home $responder)
{
$this->responder = $responder;
}
public function __invoke($request,$response)
{
return $this->responder->send();
}
}
这是响应者类
<?php
namespace Registration\Responders;
use Psr\Http\Message\ResponseInterface as Response;
class Home
{
protected $response;
public function __construct(Response $response)
{
$this->response = $response;
}
public function send()
{
return 'Test';
}
}
我遇到以下错误:
Entry "Registration\Actions\Home" cannot be resolved: Entry "Registration\Responders\Home" cannot be resolved: Entry "Psr\Http\Message\ResponseInterface" cannot be resolved: the class is not instantiable Full definition: Object ( class = #NOT INSTANTIABLE# Psr\Http\Message\ResponseInterface scope = singleton lazy = false ) Full definition: Object ( class = Registration\Responders\Home scope = singleton lazy = false __construct( $response = get(Psr\Http\Message\ResponseInterface) ) ) Full definition: Object ( class = Registration\Actions\Home scope = singleton lazy = false __construct( $responder = get(Registration\Responders\Home) ) )
我在做什么错了?