Extbase / тип проблемы после обновления с TYPO3 7 до TYPO3 9 LTS - PullRequest
0 голосов
/ 05 июля 2019

У меня есть старое расширение extbase, которое необходимо исправить после обновления с 7.6 до TYPO3 9.5.8:

Эта строка, похоже, является проблемой:

$this->registerArgument('background', FileReference::class . '|boolean', 'Image');

Ошибка Iget is

Аргумент "background" был зарегистрирован с типом "TYPO3 \ CMS \ Extbase \ Domain \ Model \ FileReference | boolean", но имеет тип "TYPO3 \ CMS \ Extbase \ Domain \ Model"\ FileReference "в помощнике вида

Однако, если я удаляю | логическое значение, я получаю новую ошибку, на этот раз

Аргумент" background "был зарегистрирован с типом"TYPO3 \ CMS \ Extbase \ Domain \ Model \ FileReference ", но имеет тип" boolean "в представлении helper

Так что я вроде как в цикле.Есть идеи?

Ответы [ 2 ]

0 голосов
/ 06 июля 2019

Мне удалось решить проблему, превратив тип в «строку». До сих пор не уверен, почему Он отправил меня в цикл раньше ...

0 голосов
/ 05 июля 2019

Я нашел функцию в typo3_src / vendor / typo3fluid / жидкости / 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');
...