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

121 Views Asked by At

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();
 }
}
2

There are 2 best solutions below

0
Daniel On

There is no such class in TYPO3 7.6.

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

0
anguish On

I changed the return type to string and returning a string, now its working.

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