我有一个旧的extbase扩展名,在从7.6更新为typo3 9.5.8:
之后,需要修复该扩展名:这条线似乎是问题:
$this->registerArgument('background', FileReference::class . '|boolean', 'Image');
我得到的错误是
参数"背景"已注册为" typo3 cms extbase extbase domain domain model fileReference | boolean",但为" typo3 cmms extbase extbase domain domain domain domain domain model fileReference"助手
但是,如果我删除|布尔值,我会收到一个新错误,这次
参数"背景"已注册为" typo3 cms extbase domain domain model fileReference",但在视图helper
中是类型的"布尔值">所以我在这里有点循环。有什么想法吗?
我在typo3_src/dypo3fluid/fluid/src/core/core/viewHelper/atrackeviewhelper
中找到了该功能/**
* 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 TYPO3FluidFluidCoreViewHelperAbstractViewHelper $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', TYPO3CMSExtbaseDomainModelFileReference, 'Image');
我能够通过将类型转换为"字符串"来解决问题。仍然不确定为什么它在...