[BUGFIX] Call to FlashMessageQueue::addMessage() method in extbase 72/25272/2
authorMarkus Klein <klein.t3@mfc-linz.at>
Wed, 2 Oct 2013 20:40:23 +0000 (22:40 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 11 Nov 2013 17:14:36 +0000 (18:14 +0100)
Extbase still uses the addMessage method, which is deprecated.
The official API is now enqueue(), let's use this one.

Resolves: #52488
Releases: 6.1, 6.2
Change-Id: I85097ee53ded9c2d2ccdc6c240667ddaa3768999
Reviewed-on: https://review.typo3.org/25272
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Controller/FlashMessageContainer.php

index 3757560..3ba7029 100644 (file)
@@ -463,7 +463,12 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
                        $errorFlashMessage = $this->getErrorFlashMessage();
                        if ($errorFlashMessage !== FALSE) {
-                               $this->controllerContext->getFlashMessageQueue()->addMessage(new \TYPO3\CMS\Core\Messaging\FlashMessage($errorFlashMessage, '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR));
+                               $errorFlashMessageObject = new \TYPO3\CMS\Core\Messaging\FlashMessage(
+                                       $errorFlashMessage,
+                                       '',
+                                       \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                               );
+                               $this->controllerContext->getFlashMessageQueue()->enqueue($errorFlashMessageObject);
                        }
                        $referringRequest = $this->request->getReferringRequest();
                        if ($referringRequest !== NULL) {
@@ -484,7 +489,12 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                        $this->request->setErrors($this->argumentsMappingResults->getErrors());
                        $errorFlashMessage = $this->getErrorFlashMessage();
                        if ($errorFlashMessage !== FALSE) {
-                               $this->controllerContext->getFlashMessageQueue()->addMessage(new \TYPO3\CMS\Core\Messaging\FlashMessage($errorFlashMessage, '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR));
+                               $errorFlashMessageObject = new \TYPO3\CMS\Core\Messaging\FlashMessage(
+                                       $errorFlashMessage,
+                                       '',
+                                       \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                               );
+                               $this->controllerContext->getFlashMessageQueue()->enqueue($errorFlashMessageObject);
                        }
                        $referrer = $this->request->getInternalArgument('__referrer');
                        if ($referrer !== NULL) {
index 39acc8e..09d2f68 100644 (file)
@@ -77,7 +77,7 @@ class FlashMessageContainer implements \TYPO3\CMS\Core\SingletonInterface {
                $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $message, $title, $severity, TRUE
                );
-               $this->controllerContext->getFlashMessageQueue()->addMessage($flashMessage);
+               $this->controllerContext->getFlashMessageQueue()->enqueue($flashMessage);
        }
 
        /**
@@ -108,4 +108,4 @@ class FlashMessageContainer implements \TYPO3\CMS\Core\SingletonInterface {
        }
 }
 
-?>
\ No newline at end of file
+?>