简体   繁体   中英

TYPO3 7.6.x Class 'TYPO3\Flow\Error\Message' not found

I want to override the getErrorFlashMessage method in my action but getting the error message Class 'TYPO3\\Flow\\Error\\Message' not found.

/**
 * @return \TYPO3\Flow\Error\Message
 */
protected function getErrorFlashMessage() {
 switch ($this->actionMethodName) {
  case 'createAction' :
   return new \TYPO3\Flow\Error\Message(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_myext_domain_model_test.createError', 'myext' ));
  default:
   return parent::getErrorFlashMessage();
 }
}

There is no such class in TYPO3 7.6.

Try \\TYPO3\\CMS\\Extbase\\Error\\Message instead.

我将返回类型更改为字符串并返回了一个字符串,现在它可以正常工作了。

return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_myext_domain_model_test.createError', 'myext' );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM