我在具有自动装配的控制器中使用TranslatorInterface
并且它正常工作:
public function __construct(LoggerInterface $logger,
TranslatorInterface $translator)
{
$this->_logger = $logger;
$this->_translator = $translator;
}
但是,当我尝试在另一个类中使用此接口和自动装配时,它不起作用:
class MunicipalityValidator
{
private $_translator;
private $_validator;
public function __construct(TranslatorInterface $translator,
ValidatorInterface $validator)
{
$this->_translator = $translator;
$this->_validator = $validator;
}
//...
}
我有以下错误消息:
FatalThrowableError
Type error: Too few arguments to function App\Validator\MunicipalityValidator::__construct(),
0 passed in /var/www/html/sf4proj/src/Factory/MunicipalityFactory.php on line 34 and
exactly 2 expected
你对这个问题有所了解吗?
感谢。