我有一个旧的extbase扩展,从7.6更新到TYPO3 9.5.8后需要修复:
这行似乎是问题所在:
$this->registerArgument('background', FileReference::class . '|boolean', 'Image');
我得到的错误是
参数“ background”已以类型“ TYPO3 \ CMS \ Extbase \ Domain \ Model \ FileReference | boolean”注册,但在视图中类型为“ TYPO3 \ CMS \ Extbase \ Domain \ Model \ FileReference”助手
但是,如果我删除| boolean,这一次出现新错误
参数“ background”已注册为类型“ TYPO3 \ CMS \ Extbase \ Domain \ Model \ FileReference”,但在视图助手中的类型为“布尔”
所以我有点陷入循环。有什么想法吗?
答案 0 :(得分:0)
我在typo3_src / vendor / typo3fluid / fluid / src / Core / ViewHelper / AbstractViewHelper中找到了该功能
/**
* Register a new argument. Call this method from your ViewHelper subclass
* inside the initializeArguments() method.
*
* @param string $name Name of the argument
* @param string $type Type of the argument
* @param string $description Description of the argument
* @param boolean $required If TRUE, argument is required. Defaults to FALSE.
* @param mixed $defaultValue Default value of argument
* @return \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper $this, to allow chaining.
* @throws Exception
* @api
*/
protected function registerArgument($name, $type, $description, $required = false, $defaultValue = null)
{
if (array_key_exists($name, $this->argumentDefinitions)) {
throw new Exception(
'Argument "' . $name . '" has already been defined, thus it should not be defined again.',
1253036401
);
}
$this->argumentDefinitions[$name] = new ArgumentDefinition($name, $type, $description, $required, $defaultValue);
return $this;
}
所以我认为您必须使用
$this->registerArgument('background', TYPO3\CMS\Extbase\Domain\Model\FileReference, 'Image');
答案 1 :(得分:0)
我能够通过将类型更改为“字符串”来解决此问题。仍然不确定为什么它让我在之前循环发送了...